Merge pull request #709 from Nekotekina/master

Various fixes, new functions
This commit is contained in:
B1ackDaemon 2014-07-29 07:14:01 +03:00
commit b98b3241e7
45 changed files with 1135 additions and 735 deletions

1
.gitignore vendored
View File

@ -64,5 +64,6 @@ rpcs3/git-version.h
bin/dev_hdd0/*.txt
x64/Debug/emucore.lib
x64/Release/emucore.lib
rpcs3/x64/*
.DS_Store

View File

@ -12,7 +12,7 @@ struct reservation_struct
// std::mutex doesn't work because it probably wakes up waiting threads in the most unwanted order
// and doesn't give a chance to finish some work before losing the reservation
u32 owner; // id of thread that got reservation
u32 addr;
u64 addr;
u32 size;
u32 data32;
u64 data64;

View File

@ -60,237 +60,7 @@ enum
MFC_SPU_MAX_QUEUE_SPACE = 0x10,
};
/*struct DMAC_Queue
{
bool is_valid;
u64 ea;
u32 lsa;
u16 size;
u32 op;
u8 tag;
u8 rt;
u16 list_addr;
u16 list_size;
u32 dep_state;
u32 cmd;
u32 dep_type;
};
struct DMAC_Proxy
{
u64 ea;
u32 lsa;
u16 size;
u32 op;
u8 tag;
u8 rt;
u16 list_addr;
u16 list_size;
u32 dep_state;
u32 cmd;
u32 dep_type;
};
template<size_t _max_count>
class SPUReg
{
u64 m_addr;
u32 m_pos;
public:
static const size_t max_count = _max_count;
static const size_t size = max_count * 4;
SPUReg()
{
Init();
}
void Init()
{
m_pos = 0;
}
void SetAddr(u64 addr)
{
m_addr = addr;
}
u64 GetAddr() const
{
return m_addr;
}
__forceinline bool Pop(u32& res)
{
if(!m_pos) return false;
res = Memory.Read32(m_addr + m_pos--);
return true;
}
__forceinline bool Push(u32 value)
{
if(m_pos >= max_count) return false;
Memory.Write32(m_addr + m_pos++, value);
return true;
}
u32 GetCount() const
{
return m_pos;
}
u32 GetFreeCount() const
{
return max_count - m_pos;
}
void SetValue(u32 value)
{
Memory.Write32(m_addr, value);
}
u32 GetValue() const
{
return Memory.Read32(m_addr);
}
};*/
struct DMAC
{
u64 ls_offset;
/*//DMAC_Queue queue[MFC_SPU_MAX_QUEUE_SPACE]; //not used yet
DMAC_Proxy proxy[MFC_PPU_MAX_QUEUE_SPACE+MFC_SPU_MAX_QUEUE_SPACE]; //temporarily 24
u32 queue_pos;
u32 proxy_pos;
long queue_lock;
volatile std::atomic<int> proxy_lock;
bool ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
{
//returns true if the command should be deleted from the queue
if (cmd & (MFC_BARRIER_MASK | MFC_FENCE_MASK)) _mm_mfence();
switch(cmd & ~(MFC_BARRIER_MASK | MFC_FENCE_MASK | MFC_LIST_MASK))
{
case MFC_PUT_CMD:
Memory.Copy(ea, ls_offset + lsa, size);
return true;
case MFC_GET_CMD:
Memory.Copy(ls_offset + lsa, ea, size);
return true;
default:
LOG_ERROR(HLE, "DMAC::ProcessCmd(): Unknown DMA cmd.");
return true;
}
}
u32 Cmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
{
if(!Memory.IsGoodAddr(ls_offset + lsa, size) || !Memory.IsGoodAddr(ea, size))
{
return MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
}
if(proxy_pos >= MFC_PPU_MAX_QUEUE_SPACE)
{
return MFC_PPU_DMA_QUEUE_FULL;
}
ProcessCmd(cmd, tag, lsa, ea, size);
return MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL;
}
void ClearCmd()
{
while (std::atomic_exchange(&proxy_lock, 1));
_mm_lfence();
memcpy(proxy, proxy + 1, --proxy_pos * sizeof(DMAC_Proxy));
_mm_sfence();
proxy_lock = 0; //release lock
}
void DoCmd()
{
if(proxy_pos)
{
const DMAC_Proxy& p = proxy[0];
if (ProcessCmd(p.cmd, p.tag, p.lsa, p.ea, p.size))
{
ClearCmd();
}
}
}*/
};
/*struct MFC
{
SPUReg<1> MFC_LSA;
SPUReg<1> MFC_EAH;
SPUReg<1> MFC_EAL;
SPUReg<1> MFC_Size_Tag;
SPUReg<1> MFC_CMDStatus;
SPUReg<1> MFC_QStatus;
SPUReg<1> Prxy_QueryType;
SPUReg<1> Prxy_QueryMask;
SPUReg<1> Prxy_TagStatus;
SPUReg<1> SPU_Out_MBox;
SPUReg<4> SPU_In_MBox;
SPUReg<1> SPU_MBox_Status;
SPUReg<1> SPU_RunCntl;
SPUReg<1> SPU_Status;
SPUReg<1> SPU_NPC;
SPUReg<1> SPU_RdSigNotify1;
SPUReg<1> SPU_RdSigNotify2;
DMAC dmac;
void Handle()
{
u32 cmd = MFC_CMDStatus.GetValue();
if(cmd)
{
u16 op = cmd & MFC_MASK_CMD;
switch(op)
{
case MFC_PUT_CMD:
case MFC_GET_CMD:
{
u32 lsa = MFC_LSA.GetValue();
u64 ea = (u64)MFC_EAL.GetValue() | ((u64)MFC_EAH.GetValue() << 32);
u32 size_tag = MFC_Size_Tag.GetValue();
u16 tag = (u16)size_tag;
u16 size = size_tag >> 16;
LOG_WARNING(HLE, "RawSPU DMA %s:", op == MFC_PUT_CMD ? "PUT" : "GET");
LOG_WARNING(HLE, "*** lsa = 0x%x", lsa);
LOG_WARNING(HLE, "*** ea = 0x%llx", ea);
LOG_WARNING(HLE, "*** tag = 0x%x", tag);
LOG_WARNING(HLE, "*** size = 0x%x", size);
LOG_WARNING(HLE, " ");
MFC_CMDStatus.SetValue(dmac.Cmd(cmd, tag, lsa, ea, size));
}
break;
default:
LOG_ERROR(HLE, "Unknown MFC cmd. (opcode=0x%x, cmd=0x%x)", op, cmd);
break;
}
}
if(Prxy_QueryType.GetValue() == 2)
{
Prxy_QueryType.SetValue(0);
u32 mask = Prxy_QueryMask.GetValue();
//
MFC_QStatus.SetValue(mask);
}
}
};*/

View File

@ -3840,7 +3840,7 @@ private:
void UNK(u32 code, u32 opcode, u32 gcode)
{
UNK(fmt::Format("(SPURecompiler) Unimplemented opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
UNK(fmt::Format("Unimplemented opcode! (0x%08x, 0x%x, 0x%x)", code, opcode, gcode));
}
void UNK(const std::string& err)

View File

@ -23,7 +23,7 @@ SPURecompilerCore::SPURecompilerCore(SPUThread& cpu)
X86CpuUtil::detect(&inf);
if (!inf.hasFeature(kX86CpuFeatureSse41))
{
LOG_ERROR(SPU, "SPU Recompiler requires SSE4.1 instruction set support");
LOG_ERROR(SPU, "SPU JIT requires SSE4.1 instruction set support");
Emu.Pause();
}
}
@ -169,13 +169,6 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address)
//ConLog.Write("DecodeMemory: pos=%d", pos);
u32* ls = (u32*)&Memory[m_offset];
if (!pos)
{
LOG_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(): ls_addr = 0");
Emu.Pause();
return 0;
}
if (entry[pos].pointer)
{
// check data (hard way)

View File

@ -579,7 +579,7 @@ public:
#define LOG_DMAC(type, text) type(Log::SPU, "DMAC::ProcessCmd(cmd=0x%x, tag=0x%x, lsa=0x%x, ea=0x%llx, size=0x%x): " text, cmd, tag, lsa, ea, size)
bool ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
void ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
{
if (cmd & (MFC_BARRIER_MASK | MFC_FENCE_MASK)) _mm_mfence();
@ -588,7 +588,8 @@ public:
if (ea >= 0x100000000)
{
LOG_DMAC(LOG_ERROR, "Invalid external address");
return false;
Emu.Pause();
return;
}
else if (group)
{
@ -597,7 +598,8 @@ public:
if (num >= group->list.size() || !group->list[num])
{
LOG_DMAC(LOG_ERROR, "Invalid thread (SPU Thread Group MMIO)");
return false;
Emu.Pause();
return;
}
SPUThread* spu = (SPUThread*)Emu.GetCPU().GetThread(group->list[num]);
@ -611,18 +613,20 @@ public:
else if ((cmd & MFC_PUT_CMD) && size == 4 && (addr == SYS_SPU_THREAD_SNR1 || addr == SYS_SPU_THREAD_SNR2))
{
spu->WriteSNR(SYS_SPU_THREAD_SNR2 == addr, Memory.Read32(dmac.ls_offset + lsa));
return true;
return;
}
else
{
LOG_DMAC(LOG_ERROR, "Invalid register (SPU Thread Group MMIO)");
return false;
Emu.Pause();
return;
}
}
else
{
LOG_DMAC(LOG_ERROR, "Thread group not set (SPU Thread Group MMIO)");
return false;
Emu.Pause();
return;
}
}
else if (ea >= RAW_SPU_BASE_ADDR && size == 4)
@ -632,19 +636,20 @@ public:
case MFC_PUT_CMD:
{
Memory.Write32(ea, ReadLS32(lsa));
return true;
return;
}
case MFC_GET_CMD:
{
WriteLS32(lsa, Memory.Read32(ea));
return true;
return;
}
default:
{
LOG_DMAC(LOG_ERROR, "Unknown DMA command");
return false;
Emu.Pause();
return;
}
}
}
@ -653,53 +658,27 @@ public:
{
case MFC_PUT_CMD:
{
if (Memory.Copy(ea, dmac.ls_offset + lsa, size))
{
return true;
}
else
{
LOG_DMAC(LOG_ERROR, "PUT* cmd failed");
return false; // TODO: page fault (?)
}
memcpy(Memory + ea, Memory + dmac.ls_offset + lsa, size);
return;
}
case MFC_GET_CMD:
{
if (Memory.Copy(dmac.ls_offset + lsa, ea, size))
{
return true;
}
else
{
LOG_DMAC(LOG_ERROR, "GET* cmd failed");
return false; // TODO: page fault (?)
}
memcpy(Memory + dmac.ls_offset + lsa, Memory + ea, size);
return;
}
default:
{
LOG_DMAC(LOG_ERROR, "Unknown DMA command");
return false; // ???
Emu.Pause();
return;
}
}
}
#undef LOG_CMD
u32 dmacCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
{
/*if(proxy_pos >= MFC_PPU_MAX_QUEUE_SPACE)
{
return MFC_PPU_DMA_QUEUE_FULL;
}*/
if (ProcessCmd(cmd, tag, lsa, ea, size))
return MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL;
else
return MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
}
void ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFCArgs)
{
u32 list_addr = ea & 0x3ffff;
@ -713,7 +692,7 @@ public:
be_t<u32> ea; // External Address Low
};
u32 result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
u32 result = MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL;
for (u32 i = 0; i < list_size; i++)
{
@ -723,15 +702,12 @@ public:
if (size < 16 && size != 1 && size != 2 && size != 4 && size != 8)
{
LOG_ERROR(Log::SPU, "DMA List: invalid transfer size(%d)", size);
return;
result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break;
}
u32 addr = rec->ea;
result = dmacCmd(cmd, tag, lsa | (addr & 0xf), addr, size);
if (result == MFC_PPU_DMA_CMD_SEQUENCE_ERROR)
{
break;
}
ProcessCmd(cmd, tag, lsa | (addr & 0xf), addr, size);
if (Ini.HLELogging.GetValue() || rec->s)
LOG_NOTICE(Log::SPU, "*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)",
@ -746,6 +722,8 @@ public:
if (StallList[tag].MFCArgs)
{
LOG_ERROR(Log::SPU, "DMA List: existing stalled list found (tag=%d)", tag);
result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break;
}
StallList[tag].MFCArgs = &MFCArgs;
StallList[tag].cmd = cmd;
@ -753,7 +731,7 @@ public:
StallList[tag].lsa = lsa;
StallList[tag].size = (list_size - i - 1) * 8;
return;
break;
}
}
@ -784,7 +762,8 @@ public:
(op & MFC_FENCE_MASK ? "F" : ""),
lsa, ea, tag, size, cmd);
MFCArgs.CMDStatus.SetValue(dmacCmd(cmd, tag, lsa, ea, size));
ProcessCmd(cmd, tag, lsa, ea, size);
MFCArgs.CMDStatus.SetValue(MFC_PPU_DMA_CMD_ENQUEUE_SUCCESSFUL);
}
break;
@ -871,21 +850,6 @@ public:
{
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])
{
last_d++;
}
else if (buf[last]._u32[last_d+1] == reservation.data[last]._u32[last_d+1])
{
last_d;
}
else // full 64 bit
{
LOG_ERROR(Log::SPU, "MFC_PUTLLC_CMD: TODO: 64bit compare and swap");
Emu.Pause();
MFCArgs.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS);
}*/
}
}
else

View File

@ -0,0 +1,81 @@
#pragma once
class LogBase
{
bool m_logging;
public:
void SetLogging(bool value)
{
m_logging = value;
}
bool GetLogging()
{
//return m_logging; // TODO
return Ini.HLELogging.GetValue();
}
LogBase()
{
SetLogging(false);
}
virtual const std::string& GetName() const = 0;
template<typename... Targs> void Notice(const u32 id, const char* fmt, Targs... args)
{
LOG_NOTICE(HLE, GetName() + fmt::Format("[%d]: ", id) + fmt::Format(fmt, args...));
}
template<typename... Targs> void Notice(const char* fmt, Targs... args)
{
LOG_NOTICE(HLE, GetName() + ": " + fmt::Format(fmt, args...));
}
template<typename... Targs> __forceinline void Log(const char* fmt, Targs... args)
{
if (GetLogging())
{
Notice(fmt, args...);
}
}
template<typename... Targs> __forceinline void Log(const u32 id, const char* fmt, Targs... args)
{
if (GetLogging())
{
Notice(id, fmt, args...);
}
}
template<typename... Targs> void Warning(const u32 id, const char* fmt, Targs... args)
{
LOG_WARNING(HLE, GetName() + fmt::Format("[%d] warning: ", id) + fmt::Format(fmt, args...));
}
template<typename... Targs> void Warning(const char* fmt, Targs... args)
{
LOG_WARNING(HLE, GetName() + " warning: " + fmt::Format(fmt, args...));
}
template<typename... Targs> void Error(const u32 id, const char* fmt, Targs... args)
{
LOG_ERROR(HLE, GetName() + fmt::Format("[%d] error: ", id) + fmt::Format(fmt, args...));
}
template<typename... Targs> void Error(const char* fmt, Targs... args)
{
LOG_ERROR(HLE, GetName() + " error: " + fmt::Format(fmt, args...));
}
template<typename... Targs> void Todo(const u32 id, const char* fmt, Targs... args)
{
LOG_ERROR(HLE, GetName() + fmt::Format("[%d] TODO: ", id) + fmt::Format(fmt, args...));
}
template<typename... Targs> void Todo(const char* fmt, Targs... args)
{
LOG_ERROR(HLE, GetName() + " TODO: " + fmt::Format(fmt, args...));
}
};

View File

@ -148,7 +148,7 @@ u16 Module::GetID() const
return m_id;
}
std::string Module::GetName() const
const std::string& Module::GetName() const
{
return m_name;
}
@ -158,60 +158,6 @@ void Module::SetName(const std::string& name)
m_name = name;
}
void Module::Log(const u32 id, std::string fmt, ...)
{
if(Ini.HLELogging.GetValue())
{
va_list list;
va_start(list, fmt);
LOG_NOTICE(HLE, GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list));
va_end(list);
}
}
void Module::Log(std::string fmt, ...)
{
if(Ini.HLELogging.GetValue())
{
va_list list;
va_start(list, fmt);
LOG_NOTICE(HLE, GetName() + ": " + fmt::FormatV(fmt, list));
va_end(list);
}
}
void Module::Warning(const u32 id, std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_WARNING(HLE, GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list));
va_end(list);
}
void Module::Warning(std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_WARNING(HLE, GetName() + " warning: " + fmt::FormatV(fmt, list));
va_end(list);
}
void Module::Error(const u32 id, std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_ERROR(HLE, GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list));
va_end(list);
}
void Module::Error(std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_ERROR(HLE, GetName() + " error: " + fmt::FormatV(fmt, list));
va_end(list);
}
bool Module::CheckID(u32 id) const
{
return Emu.GetIdManager().CheckID(id) && Emu.GetIdManager().GetID(id).m_name == GetName();

View File

@ -1,6 +1,7 @@
#pragma once
#include "Emu/SysCalls/SC_FUNC.h"
#include "LogBase.h"
//TODO
struct ModuleFunc
@ -41,7 +42,7 @@ struct SFunc
}
};
class Module
class Module : public LogBase
{
std::string m_name;
u16 m_id;
@ -73,20 +74,10 @@ public:
bool IsLoaded() const;
u16 GetID() const;
std::string GetName() const;
virtual const std::string& GetName() const override;
void SetName(const std::string& name);
public:
//TODO: use variadic function templates here to be able to use string references and forward all arguments without copying
void Log(const u32 id, std::string fmt, ...);
void Log(std::string fmt, ...);
void Warning(const u32 id, std::string fmt, ...);
void Warning(std::string fmt, ...);
void Error(const u32 id, std::string fmt, ...);
void Error(std::string fmt, ...);
bool CheckID(u32 id) const;
template<typename T> bool CheckId(u32 id, T*& data)
{

View File

@ -534,7 +534,7 @@ bool adecCheckType(AudioCodecType type)
case CELL_ADEC_TYPE_CELP:
case CELL_ADEC_TYPE_M4AAC:
case CELL_ADEC_TYPE_CELP8:
cellAdec->Error("Unimplemented audio codec type (%d)", type);
cellAdec->Todo("Unimplemented audio codec type (%d)", type);
break;
default:
return false;
@ -640,7 +640,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
}
else*/
{
cellAdec->Warning("cellAdecStartSeq: (TODO) initialization");
cellAdec->Todo("cellAdecStartSeq(): initialization");
}
adec->job.Push(task);

View File

@ -10,7 +10,7 @@ Module *cellAtrac = nullptr;
int cellAtracSetDataAndGetMemSize(mem_ptr_t<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, mem32_t puiWorkMemByte)
{
cellAtrac->Error("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)",
cellAtrac->Todo("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)",
pHandle.GetAddr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.GetAddr());
puiWorkMemByte = 0x1000; // unproved
@ -19,7 +19,7 @@ int cellAtracSetDataAndGetMemSize(mem_ptr_t<CellAtracHandle> pHandle, u32 pucBuf
int cellAtracCreateDecoder(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority)
{
cellAtrac->Error("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)",
cellAtrac->Todo("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)",
pHandle.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority);
pHandle->data.pucWorkMem_addr = pucWorkMem_addr;
@ -28,7 +28,7 @@ int cellAtracCreateDecoder(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_ad
int cellAtracCreateDecoderExt(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, mem_ptr_t<CellAtracExtRes> pExtRes)
{
cellAtrac->Error("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)",
cellAtrac->Todo("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)",
pHandle.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.GetAddr());
pHandle->data.pucWorkMem_addr = pucWorkMem_addr;
@ -37,13 +37,13 @@ int cellAtracCreateDecoderExt(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem
int cellAtracDeleteDecoder(mem_ptr_t<CellAtracHandle> pHandle)
{
cellAtrac->Error("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr());
cellAtrac->Todo("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr());
return CELL_OK;
}
int cellAtracDecode(mem_ptr_t<CellAtracHandle> pHandle, u32 pfOutAddr, mem32_t puiSamples, mem32_t puiFinishflag, mem32_t piRemainFrame)
{
cellAtrac->Error("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)",
cellAtrac->Todo("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)",
pHandle.GetAddr(), pfOutAddr, puiSamples.GetAddr(), puiFinishflag.GetAddr(), piRemainFrame.GetAddr());
puiSamples = 0;
@ -54,7 +54,7 @@ int cellAtracDecode(mem_ptr_t<CellAtracHandle> pHandle, u32 pfOutAddr, mem32_t p
int cellAtracGetStreamDataInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t ppucWritePointer, mem32_t puiWritableByte, mem32_t puiReadPosition)
{
cellAtrac->Error("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)",
cellAtrac->Todo("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)",
pHandle.GetAddr(), ppucWritePointer.GetAddr(), puiWritableByte.GetAddr(), puiReadPosition.GetAddr());
ppucWritePointer = pHandle->data.pucWorkMem_addr;
@ -65,13 +65,13 @@ int cellAtracGetStreamDataInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t ppucW
int cellAtracAddStreamData(mem_ptr_t<CellAtracHandle> pHandle, u32 uiAddByte)
{
cellAtrac->Error("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.GetAddr(), uiAddByte);
cellAtrac->Todo("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.GetAddr(), uiAddByte);
return CELL_OK;
}
int cellAtracGetRemainFrame(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piRemainFrame)
{
cellAtrac->Error("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.GetAddr(), piRemainFrame.GetAddr());
cellAtrac->Todo("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.GetAddr(), piRemainFrame.GetAddr());
piRemainFrame = CELL_ATRAC_ALLDATA_IS_ON_MEMORY;
return CELL_OK;
@ -79,7 +79,7 @@ int cellAtracGetRemainFrame(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piRemain
int cellAtracGetVacantSize(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiVacantSize)
{
cellAtrac->Error("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.GetAddr(), puiVacantSize.GetAddr());
cellAtrac->Todo("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.GetAddr(), puiVacantSize.GetAddr());
puiVacantSize = 0x1000;
return CELL_OK;
@ -87,13 +87,13 @@ int cellAtracGetVacantSize(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiVacant
int cellAtracIsSecondBufferNeeded(mem_ptr_t<CellAtracHandle> pHandle)
{
cellAtrac->Error("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr());
cellAtrac->Todo("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr());
return CELL_OK;
}
int cellAtracGetSecondBufferInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiReadPosition, mem32_t puiDataByte)
{
cellAtrac->Error("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)",
cellAtrac->Todo("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)",
pHandle.GetAddr(), puiReadPosition.GetAddr(), puiDataByte.GetAddr());
puiReadPosition = 0;
@ -103,14 +103,14 @@ int cellAtracGetSecondBufferInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t pui
int cellAtracSetSecondBuffer(mem_ptr_t<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte)
{
cellAtrac->Error("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)",
cellAtrac->Todo("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)",
pHandle.GetAddr(), pucSecondBufferAddr, uiSecondBufferByte);
return CELL_OK;
}
int cellAtracGetChannel(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiChannel)
{
cellAtrac->Error("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.GetAddr(), puiChannel.GetAddr());
cellAtrac->Todo("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.GetAddr(), puiChannel.GetAddr());
puiChannel = 2;
return CELL_OK;
@ -118,7 +118,7 @@ int cellAtracGetChannel(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiChannel)
int cellAtracGetMaxSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiMaxSample)
{
cellAtrac->Error("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.GetAddr(), puiMaxSample.GetAddr());
cellAtrac->Todo("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.GetAddr(), puiMaxSample.GetAddr());
puiMaxSample = 512;
return CELL_OK;
@ -126,7 +126,7 @@ int cellAtracGetMaxSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiMaxSamp
int cellAtracGetNextSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiNextSample)
{
cellAtrac->Error("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.GetAddr(), puiNextSample.GetAddr());
cellAtrac->Todo("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.GetAddr(), puiNextSample.GetAddr());
puiNextSample = 0;
return CELL_OK;
@ -134,7 +134,7 @@ int cellAtracGetNextSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiNextSa
int cellAtracGetSoundInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piEndSample, mem32_t piLoopStartSample, mem32_t piLoopEndSample)
{
cellAtrac->Error("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)",
cellAtrac->Todo("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)",
pHandle.GetAddr(), piEndSample.GetAddr(), piLoopStartSample.GetAddr(), piLoopEndSample.GetAddr());
piEndSample = 0;
@ -145,7 +145,7 @@ int cellAtracGetSoundInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piEndSampl
int cellAtracGetNextDecodePosition(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiSamplePosition)
{
cellAtrac->Error("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)",
cellAtrac->Todo("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)",
pHandle.GetAddr(), puiSamplePosition.GetAddr());
puiSamplePosition = 0;
@ -154,7 +154,7 @@ int cellAtracGetNextDecodePosition(mem_ptr_t<CellAtracHandle> pHandle, mem32_t p
int cellAtracGetBitrate(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiBitrate)
{
cellAtrac->Error("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)",
cellAtrac->Todo("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)",
pHandle.GetAddr(), puiBitrate.GetAddr());
puiBitrate = 128;
@ -163,7 +163,7 @@ int cellAtracGetBitrate(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiBitrate)
int cellAtracGetLoopInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piLoopNum, mem32_t puiLoopStatus)
{
cellAtrac->Error("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)",
cellAtrac->Todo("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)",
pHandle.GetAddr(), piLoopNum.GetAddr(), puiLoopStatus.GetAddr());
piLoopNum = 0;
@ -173,13 +173,13 @@ int cellAtracGetLoopInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piLoopNum,
int cellAtracSetLoopNum(mem_ptr_t<CellAtracHandle> pHandle, int iLoopNum)
{
cellAtrac->Error("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.GetAddr(), iLoopNum);
cellAtrac->Todo("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.GetAddr(), iLoopNum);
return CELL_OK;
}
int cellAtracGetBufferInfoForResetting(mem_ptr_t<CellAtracHandle> pHandle, u32 uiSample, mem_ptr_t<CellAtracBufferInfo> pBufferInfo)
{
cellAtrac->Error("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)",
cellAtrac->Todo("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)",
pHandle.GetAddr(), uiSample, pBufferInfo.GetAddr());
pBufferInfo->pucWriteAddr = pHandle->data.pucWorkMem_addr;
@ -191,14 +191,14 @@ int cellAtracGetBufferInfoForResetting(mem_ptr_t<CellAtracHandle> pHandle, u32 u
int cellAtracResetPlayPosition(mem_ptr_t<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte)
{
cellAtrac->Error("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)",
cellAtrac->Todo("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)",
pHandle.GetAddr(), uiSample, uiWriteByte);
return CELL_OK;
}
int cellAtracGetInternalErrorInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piResult)
{
cellAtrac->Error("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)",
cellAtrac->Todo("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)",
pHandle.GetAddr(), piResult.GetAddr());
piResult = 0;

View File

@ -736,7 +736,7 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
int cellAudioSetPortLevel(u32 portNum, float level)
{
cellAudio->Error("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level);
cellAudio->Todo("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level);
return CELL_OK;
}
@ -771,7 +771,7 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
int cellAudioCreateNotifyEventQueueEx(mem32_t id, mem64_t key, u32 iFlags)
{
cellAudio->Error("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.GetAddr(), iFlags);
cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.GetAddr(), iFlags);
return CELL_OK;
}
@ -803,7 +803,7 @@ int cellAudioSetNotifyEventQueue(u64 key)
int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags)
{
cellAudio->Error("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
cellAudio->Todo("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
return CELL_OK;
}
@ -843,49 +843,49 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags)
{
cellAudio->Error("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
cellAudio->Todo("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags);
return CELL_OK;
}
int cellAudioAddData(u32 portNum, mem32_t src, u32 samples, float volume)
{
cellAudio->Error("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume);
cellAudio->Todo("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume);
return CELL_OK;
}
int cellAudioAdd2chData(u32 portNum, mem32_t src, u32 samples, float volume)
{
cellAudio->Error("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume);
cellAudio->Todo("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume);
return CELL_OK;
}
int cellAudioAdd6chData(u32 portNum, mem32_t src, float volume)
{
cellAudio->Error("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.GetAddr(), volume);
cellAudio->Todo("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.GetAddr(), volume);
return CELL_OK;
}
int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume)
{
cellAudio->Error("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume);
cellAudio->Todo("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume);
return CELL_OK;
}
int cellAudioSendAck(u64 data3)
{
cellAudio->Error("cellAudioSendAck(data3=0x%llx)", data3);
cellAudio->Todo("cellAudioSendAck(data3=0x%llx)", data3);
return CELL_OK;
}
int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice)
{
cellAudio->Error("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice);
cellAudio->Todo("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice);
return CELL_OK;
}
int cellAudioUnsetPersonalDevice(int iPersonalStream)
{
cellAudio->Error("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream);
cellAudio->Todo("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream);
return CELL_OK;
}

View File

@ -221,7 +221,7 @@ int cellGameDataCheckCreate2(u32 version, const mem_list_ptr_t<u8> dirName, u32
if (!Emu.GetVFS().ExistsDir(dir))
{
cellGame->Error("cellGameDataCheckCreate2(): TODO: creating directory '%s'", dir.c_str());
cellGame->Todo("cellGameDataCheckCreate2(): creating directory '%s'", dir.c_str());
// TODO: create data
return CELL_GAMEDATA_RET_OK;
}
@ -275,7 +275,7 @@ int cellGameDataCheckCreate2(u32 version, const mem_list_ptr_t<u8> dirName, u32
if (cbSet->setParam.GetAddr())
{
// TODO: write PARAM.SFO from cbSet
cellGame->Error("cellGameDataCheckCreate2(): TODO: writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam.GetAddr());
cellGame->Todo("cellGameDataCheckCreate2(): writing PARAM.SFO parameters (addr=0x%x)", cbSet->setParam.GetAddr());
}
switch ((s32)cbResult->result)
@ -318,7 +318,7 @@ int cellGameDataCheckCreate(u32 version, const mem_list_ptr_t<u8> dirName, u32 e
int cellGameCreateGameData(mem_ptr_t<CellGameSetInitParams> init, mem_list_ptr_t<u8> tmp_contentInfoPath, mem_list_ptr_t<u8> tmp_usrdirPath)
{
cellGame->Error("cellGameCreateGameData(init_addr=0x%x, tmp_contentInfoPath_addr=0x%x, tmp_usrdirPath_addr=0x%x)",
cellGame->Todo("cellGameCreateGameData(init_addr=0x%x, tmp_contentInfoPath_addr=0x%x, tmp_usrdirPath_addr=0x%x)",
init.GetAddr(), tmp_contentInfoPath.GetAddr(), tmp_usrdirPath.GetAddr());
// TODO: create temporary game directory, set initial PARAM.SFO parameters

View File

@ -612,7 +612,7 @@ int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
int cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask)
{
cellGcmSys->Warning("TODO: cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
cellGcmSys->Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
if (index >= RSXThread::m_zculls_count)
@ -1096,7 +1096,7 @@ int cellGcmSetFlipCommand(u32 ctx, u32 id)
s64 cellGcmFunc15()
{
cellGcmSys->Error("cellGcmFunc15()");
cellGcmSys->Todo("cellGcmFunc15()");
return 0;
}

View File

@ -621,7 +621,7 @@ int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf)
int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 epIndex, mem_ptr_t<CellPamfEpIterator> pIt)
{
cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr());
cellPamf->Todo("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
{
@ -636,7 +636,7 @@ int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 ep
int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp, mem_ptr_t<CellPamfEpIterator> pIt)
{
cellPamf->Error("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr());
cellPamf->Todo("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr());
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
@ -647,7 +647,7 @@ int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t<CellPamfReader> pSelf, me
int cellPamfEpIteratorGetEp(mem_ptr_t<CellPamfEpIterator> pIt, mem_ptr_t<CellPamfEp> pEp)
{
cellPamf->Error("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.GetAddr(), pEp.GetAddr());
cellPamf->Todo("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.GetAddr(), pEp.GetAddr());
//TODO:
@ -656,7 +656,7 @@ int cellPamfEpIteratorGetEp(mem_ptr_t<CellPamfEpIterator> pIt, mem_ptr_t<CellPam
int cellPamfEpIteratorMove(mem_ptr_t<CellPamfEpIterator> pIt, s32 steps, mem_ptr_t<CellPamfEp> pEp)
{
cellPamf->Error("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.GetAddr(), steps, pEp.GetAddr());
cellPamf->Todo("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.GetAddr(), steps, pEp.GetAddr());
//TODO:

View File

@ -659,7 +659,7 @@ void cellRescExit()
if (!s_rescInternalInstance->m_bInitialized)
{
cellResc->Error("cellRescExit()");
cellResc->Error("cellRescExit(): not initialized");
return;
}

View File

@ -167,7 +167,7 @@ int cellSpursAttributeSetNamePrefix(mem_ptr_t<CellSpursAttribute> attr, const me
int cellSpursAttributeEnableSpuPrintfIfAvailable(mem_ptr_t<CellSpursAttribute> attr)
{
cellSpurs->Error("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.GetAddr());
cellSpurs->Todo("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.GetAddr());
if (attr.GetAddr() % 8 != 0)
{
@ -208,7 +208,7 @@ int cellSpursAttributeSetSpuThreadGroupType(mem_ptr_t<CellSpursAttribute> attr,
int cellSpursAttributeEnableSystemWorkload(mem_ptr_t<CellSpursAttribute> attr, const u8 priority[CELL_SPURS_MAX_SPU],
u32 maxSpu, const bool isPreemptible[CELL_SPURS_MAX_SPU])
{
cellSpurs->Error("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority[%u], maxSpu=%u, isPreemptible[%u])", attr.GetAddr(), priority, maxSpu, isPreemptible);
cellSpurs->Todo("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority[%u], maxSpu=%u, isPreemptible[%u])", attr.GetAddr(), priority, maxSpu, isPreemptible);
if (attr.GetAddr() % 8 != 0)
{
@ -235,7 +235,7 @@ int cellSpursAttributeEnableSystemWorkload(mem_ptr_t<CellSpursAttribute> attr, c
int cellSpursGetSpuThreadGroupId(mem_ptr_t<CellSpurs> spurs, mem32_t group)
{
cellSpurs->Error("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.GetAddr(), group.GetAddr());
cellSpurs->Todo("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.GetAddr(), group.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -254,7 +254,7 @@ int cellSpursGetSpuThreadGroupId(mem_ptr_t<CellSpurs> spurs, mem32_t group)
int cellSpursGetNumSpuThread(mem_ptr_t<CellSpurs> spurs, mem32_t nThreads)
{
cellSpurs->Error("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), nThreads.GetAddr());
cellSpurs->Todo("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), nThreads.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -273,7 +273,7 @@ int cellSpursGetNumSpuThread(mem_ptr_t<CellSpurs> spurs, mem32_t nThreads)
int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t nThreads)
{
cellSpurs->Error("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr());
cellSpurs->Todo("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -292,7 +292,7 @@ int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t
int cellSpursSetMaxContention(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 maxContention)
{
cellSpurs->Error("cellSpursSetMaxContention(spurs_addr=0x%x, workloadId=%u, maxContention=%u)", spurs.GetAddr(), workloadId, maxContention);
cellSpurs->Todo("cellSpursSetMaxContention(spurs_addr=0x%x, workloadId=%u, maxContention=%u)", spurs.GetAddr(), workloadId, maxContention);
if (spurs.GetAddr() % 128 != 0)
{
@ -311,7 +311,7 @@ int cellSpursSetMaxContention(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 ma
int cellSpursSetPriorities(mem_ptr_t<CellSpurs> spurs, u32 workloadId, const u8 priorities[CELL_SPURS_MAX_SPU])
{
cellSpurs->Error("cellSpursSetPriorities(spurs_addr=0x%x, workloadId=%u, priorities[%u])", spurs.GetAddr(), workloadId, priorities);
cellSpurs->Todo("cellSpursSetPriorities(spurs_addr=0x%x, workloadId=%u, priorities[%u])", spurs.GetAddr(), workloadId, priorities);
if (spurs.GetAddr() % 128 != 0)
{
@ -330,7 +330,7 @@ int cellSpursSetPriorities(mem_ptr_t<CellSpurs> spurs, u32 workloadId, const u8
int cellSpursSetPriority(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 spuId, u32 priority)
{
cellSpurs->Error("cellSpursSetPriority(spurs_addr=0x%x, workloadId=%u, spuId=%u, priority=%u)", spurs.GetAddr(), workloadId, spuId, priority);
cellSpurs->Todo("cellSpursSetPriority(spurs_addr=0x%x, workloadId=%u, spuId=%u, priority=%u)", spurs.GetAddr(), workloadId, spuId, priority);
if (spurs.GetAddr() % 128 != 0)
{
@ -349,7 +349,7 @@ int cellSpursSetPriority(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 spuId,
int cellSpursSetPreemptionVictimHints(mem_ptr_t<CellSpurs> spurs, const bool isPreemptible[CELL_SPURS_MAX_SPU])
{
cellSpurs->Error("cellSpursSetPreemptionVictimHints(spurs_addr=0x%x, isPreemptible[%u])", spurs.GetAddr(), isPreemptible);
cellSpurs->Todo("cellSpursSetPreemptionVictimHints(spurs_addr=0x%x, isPreemptible[%u])", spurs.GetAddr(), isPreemptible);
if (spurs.GetAddr() % 128 != 0)
{
@ -410,7 +410,7 @@ int cellSpursDetachLv2EventQueue(mem_ptr_t<CellSpurs> spurs, u8 port)
int cellSpursEnableExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, bool flag)
{
cellSpurs->Error("cellSpursEnableExceptionEventHandler(spurs_addr=0x%x, flag=%u)", spurs.GetAddr(), flag);
cellSpurs->Todo("cellSpursEnableExceptionEventHandler(spurs_addr=0x%x, flag=%u)", spurs.GetAddr(), flag);
if (spurs.GetAddr() % 128 != 0)
{
@ -429,7 +429,7 @@ int cellSpursEnableExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, bool flag)
int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, mem_func_ptr_t<CellSpursGlobalExceptionEventHandler> eaHandler, mem_ptr_t<void> arg)
{
cellSpurs->Error("cellSpursSetGlobalExceptionEventHandler(spurs_addr=0x%x, eaHandler_addr=0x%x, arg_addr=0x%x,)", spurs.GetAddr(), eaHandler.GetAddr(), arg.GetAddr());
cellSpurs->Todo("cellSpursSetGlobalExceptionEventHandler(spurs_addr=0x%x, eaHandler_addr=0x%x, arg_addr=0x%x,)", spurs.GetAddr(), eaHandler.GetAddr(), arg.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -448,7 +448,7 @@ int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, mem_func
int cellSpursUnsetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs)
{
cellSpurs->Error("cellSpursUnsetGlobalExceptionEventHandler(spurs_addr=0x%x)", spurs.GetAddr());
cellSpurs->Todo("cellSpursUnsetGlobalExceptionEventHandler(spurs_addr=0x%x)", spurs.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -467,7 +467,7 @@ int cellSpursUnsetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs)
int cellSpursGetInfo(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursInfo> info)
{
cellSpurs->Error("cellSpursGetInfo(spurs_addr=0x%x, info_addr=0x%x)", spurs.GetAddr(), info.GetAddr());
cellSpurs->Todo("cellSpursGetInfo(spurs_addr=0x%x, info_addr=0x%x)", spurs.GetAddr(), info.GetAddr());
if (spurs.GetAddr() % 128 != 0)
{
@ -507,7 +507,7 @@ int _cellSpursEventFlagInitialize(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpur
int cellSpursEventFlagAttachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFlag)
{
cellSpurs->Error("cellSpursEventFlagAttachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr());
cellSpurs->Todo("cellSpursEventFlagAttachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr());
if (eventFlag.GetAddr() % 128 != 0)
{
@ -526,7 +526,7 @@ int cellSpursEventFlagAttachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFla
int cellSpursEventFlagDetachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFlag)
{
cellSpurs->Error("cellSpursEventFlagDetachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr());
cellSpurs->Todo("cellSpursEventFlagDetachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr());
if (eventFlag.GetAddr() % 128 != 0)
{
@ -545,7 +545,7 @@ int cellSpursEventFlagDetachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFla
int cellSpursEventFlagWait(mem_ptr_t<CellSpursEventFlag> eventFlag, mem16_t mask, u32 mode)
{
cellSpurs->Error("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode);
cellSpurs->Todo("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode);
if (eventFlag.GetAddr() % 128 != 0)
{
@ -564,7 +564,7 @@ int cellSpursEventFlagWait(mem_ptr_t<CellSpursEventFlag> eventFlag, mem16_t mask
int cellSpursEventFlagClear(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
{
cellSpurs->Error("cellSpursEventFlagClear(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits);
cellSpurs->Todo("cellSpursEventFlagClear(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits);
if (eventFlag.GetAddr() % 128 != 0)
{
@ -583,7 +583,7 @@ int cellSpursEventFlagClear(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
int cellSpursEventFlagSet(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
{
cellSpurs->Error("cellSpursEventFlagSet(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits);
cellSpurs->Todo("cellSpursEventFlagSet(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits);
if (eventFlag.GetAddr() % 128 != 0)
{
@ -602,7 +602,7 @@ int cellSpursEventFlagSet(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
int cellSpursEventFlagTryWait(mem_ptr_t<CellSpursEventFlag> eventFlag, mem16_t mask, u32 mode)
{
cellSpurs->Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode);
cellSpurs->Todo("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode);
if (eventFlag.GetAddr() % 128 != 0)
{
@ -663,7 +663,7 @@ int cellSpursEventFlagGetClearMode(mem_ptr_t<CellSpursEventFlag> eventFlag, mem3
int cellSpursEventFlagGetTasksetAddress(mem_ptr_t<CellSpursEventFlag> eventFlag, mem_ptr_t<CellSpursTaskset> taskset)
{
cellSpurs->Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, taskset_addr=0x%x)", eventFlag.GetAddr(), taskset.GetAddr());
cellSpurs->Todo("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, taskset_addr=0x%x)", eventFlag.GetAddr(), taskset.GetAddr());
if (eventFlag.GetAddr() % 128 != 0)
{
@ -944,7 +944,7 @@ int cellSpursCreateTasksetWithAttribute()
int cellSpursCreateTaskset(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursTaskset> taskset, u64 args, mem8_t priority, u32 maxContention)
{
cellSpurs->Error("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%x, priority_addr=0x%x, maxContention=%u)", spurs.GetAddr(), taskset.GetAddr(), args, priority.GetAddr(), maxContention);
cellSpurs->Todo("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%x, priority_addr=0x%x, maxContention=%u)", spurs.GetAddr(), taskset.GetAddr(), args, priority.GetAddr(), maxContention);
if ((spurs.GetAddr() % 128 != 0) || (taskset.GetAddr() % 128 != 0))
{
@ -966,7 +966,7 @@ int cellSpursCreateTaskset(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursTaskse
int cellSpursJoinTaskset(mem_ptr_t<CellSpursTaskset> taskset)
{
cellSpurs->Error("cellSpursJoinTaskset(taskset_addr=0x%x)", taskset.GetAddr());
cellSpurs->Todo("cellSpursJoinTaskset(taskset_addr=0x%x)", taskset.GetAddr());
if (taskset.GetAddr() % 128 != 0)
{
@ -985,7 +985,7 @@ int cellSpursJoinTaskset(mem_ptr_t<CellSpursTaskset> taskset)
int cellSpursGetTasksetId(mem_ptr_t<CellSpursTaskset> taskset, mem32_t workloadId)
{
cellSpurs->Error("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.GetAddr(), workloadId.GetAddr());
cellSpurs->Todo("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.GetAddr(), workloadId.GetAddr());
if (taskset.GetAddr() % 128 != 0)
{
@ -1004,7 +1004,7 @@ int cellSpursGetTasksetId(mem_ptr_t<CellSpursTaskset> taskset, mem32_t workloadI
int cellSpursShutdownTaskset(mem_ptr_t<CellSpursTaskset> taskset)
{
cellSpurs->Error("cellSpursShutdownTaskset(taskset_addr=0x%x)", taskset.GetAddr());
cellSpurs->Todo("cellSpursShutdownTaskset(taskset_addr=0x%x)", taskset.GetAddr());
if (taskset.GetAddr() % 128 != 0)
{
@ -1025,7 +1025,7 @@ int cellSpursCreateTask(mem_ptr_t<CellSpursTaskset> taskset, mem32_t taskID, mem
mem_ptr_t<void> context_addr, u32 context_size, mem_ptr_t<CellSpursTaskLsPattern> lsPattern,
mem_ptr_t<CellSpursTaskArgument> argument)
{
cellSpurs->Error("cellSpursCreateTask(taskset_addr=0x%x, taskID_addr=0x%x, elf_addr_addr=0x%x, context_addr_addr=0x%x, context_size=%u, lsPattern_addr=0x%x, argument_addr=0x%x)",
cellSpurs->Todo("cellSpursCreateTask(taskset_addr=0x%x, taskID_addr=0x%x, elf_addr_addr=0x%x, context_addr_addr=0x%x, context_size=%u, lsPattern_addr=0x%x, argument_addr=0x%x)",
taskset.GetAddr(), taskID.GetAddr(), elf_addr.GetAddr(), context_addr.GetAddr(), context_size, lsPattern.GetAddr(), argument.GetAddr());
if (taskset.GetAddr() % 128 != 0)
@ -1045,7 +1045,7 @@ int cellSpursCreateTask(mem_ptr_t<CellSpursTaskset> taskset, mem32_t taskID, mem
int _cellSpursSendSignal(mem_ptr_t<CellSpursTaskset> taskset, u32 taskID)
{
cellSpurs->Error("_cellSpursSendSignal(taskset_addr=0x%x, taskID=%u)", taskset.GetAddr(), taskID);
cellSpurs->Todo("_cellSpursSendSignal(taskset_addr=0x%x, taskID=%u)", taskset.GetAddr(), taskID);
if (taskset.GetAddr() % 128 != 0)
{

View File

@ -4,51 +4,17 @@
#include "Emu/System.h"
#include "Emu/SysCalls/Modules.h"
#include "cellSync.h"
//void cellSync_init();
//Module cellSync("cellSync", cellSync_init);
Module *cellSync = nullptr;
// Return Codes
enum
s32 cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
{
CELL_SYNC_ERROR_AGAIN = 0x80410101,
CELL_SYNC_ERROR_INVAL = 0x80410102,
CELL_SYNC_ERROR_NOMEM = 0x80410104,
CELL_SYNC_ERROR_DEADLK = 0x80410108,
CELL_SYNC_ERROR_PERM = 0x80410109,
CELL_SYNC_ERROR_BUSY = 0x8041010A,
CELL_SYNC_ERROR_STAT = 0x8041010F,
CELL_SYNC_ERROR_ALIGN = 0x80410110,
CELL_SYNC_ERROR_NULL_POINTER = 0x80410111,
CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD = 0x80410112,
CELL_SYNC_ERROR_NO_NOTIFIER = 0x80410113,
CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410114,
};
cellSync->Log("cellSyncMutexInitialize(mutex_addr=0x%x)", mutex.GetAddr());
struct CellSyncMutex
{
be_t<u16> m_freed;
be_t<u16> m_order;
volatile u32& m_data()
{
return *reinterpret_cast<u32*>(this);
};
/*
(???) Initialize: set zeros
(???) Lock: increase m_order and wait until m_freed == old m_order
(???) Unlock: increase m_freed
(???) TryLock: ?????
*/
};
static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong sizeof");
int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
{
cellSync->Log("cellSyncMutexInitialize(mutex=0x%x)", mutex.GetAddr());
if (!mutex.IsGood())
if (!mutex)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
@ -57,15 +23,17 @@ int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
return CELL_SYNC_ERROR_ALIGN;
}
// prx: set zero and sync
mutex->m_data() = 0;
InterlockedCompareExchange(&mutex->m_data(), 0, 0);
return CELL_OK;
}
int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
s32 cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
{
cellSync->Log("cellSyncMutexLock(mutex=0x%x)", mutex.GetAddr());
cellSync->Log("cellSyncMutexLock(mutex_addr=0x%x)", mutex.GetAddr());
if (!mutex.IsGood())
if (!mutex)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
@ -74,6 +42,7 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
return CELL_SYNC_ERROR_ALIGN;
}
// prx: increase u16 and remember its old value
be_t<u16> old_order;
while (true)
{
@ -82,28 +51,31 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
new_mutex.m_data() = old_data;
old_order = new_mutex.m_order;
new_mutex.m_order++;
new_mutex.m_order++; // increase m_order
if (InterlockedCompareExchange(&mutex->m_data(), new_mutex.m_data(), old_data) == old_data) break;
}
while (old_order != mutex->m_freed)
// prx: wait until another u16 value == old value
while (old_order != mutex->m_freed)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
LOG_WARNING(HLE, "cellSyncMutexLock(mutex=0x%x) aborted", mutex.GetAddr());
LOG_WARNING(HLE, "cellSyncMutexLock(mutex_addr=0x%x) aborted", mutex.GetAddr());
break;
}
}
_mm_mfence();
// prx: sync
InterlockedCompareExchange(&mutex->m_data(), 0, 0);
return CELL_OK;
}
int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
s32 cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
{
cellSync->Log("cellSyncMutexTryLock(mutex=0x%x)", mutex.GetAddr());
cellSync->Log("cellSyncMutexTryLock(mutex_addr=0x%x)", mutex.GetAddr());
if (!mutex.IsGood())
if (!mutex)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
@ -112,34 +84,32 @@ int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
return CELL_SYNC_ERROR_ALIGN;
}
int res;
while (true)
{
const u32 old_data = mutex->m_data();
CellSyncMutex new_mutex;
new_mutex.m_data() = old_data;
// prx: compare two u16 values and exit if not equal
if (new_mutex.m_order != new_mutex.m_freed)
{
res = CELL_SYNC_ERROR_BUSY;
return CELL_SYNC_ERROR_BUSY;
}
else
{
new_mutex.m_order++;
res = CELL_OK;
}
if (InterlockedCompareExchange(&mutex->m_data(), new_mutex.m_data(), old_data) == old_data) break;
}
return res;
return CELL_OK;
}
int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
s32 cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
{
cellSync->Log("cellSyncMutexUnlock(mutex=0x%x)", mutex.GetAddr());
cellSync->Log("cellSyncMutexUnlock(mutex_addr=0x%x)", mutex.GetAddr());
if (!mutex.IsGood())
if (!mutex)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
@ -148,6 +118,8 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
return CELL_SYNC_ERROR_ALIGN;
}
InterlockedCompareExchange(&mutex->m_data(), 0, 0);
while (true)
{
const u32 old_data = mutex->m_data();
@ -161,10 +133,641 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
return CELL_OK;
}
s32 cellSyncBarrierInitialize(mem_ptr_t<CellSyncBarrier> barrier, u16 total_count)
{
cellSync->Log("cellSyncBarrierInitialize(barrier_addr=0x%x, total_count=%d)", barrier.GetAddr(), total_count);
if (!barrier)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (barrier.GetAddr() % 4)
{
return CELL_SYNC_ERROR_ALIGN;
}
if (!total_count || total_count > 32767)
{
return CELL_SYNC_ERROR_INVAL;
}
// prx: zeroize first u16, write total_count in second u16 and sync
barrier->m_value = 0;
barrier->m_count = total_count;
InterlockedCompareExchange(&barrier->m_data(), 0, 0);
return CELL_OK;
}
s32 cellSyncBarrierNotify(mem_ptr_t<CellSyncBarrier> barrier)
{
cellSync->Todo("cellSyncBarrierNotify(barrier_addr=0x%x)", barrier.GetAddr());
if (!barrier)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (barrier.GetAddr() % 4)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncBarrierTryNotify(mem_ptr_t<CellSyncBarrier> barrier)
{
cellSync->Todo("cellSyncBarrierTryNotify(barrier_addr=0x%x)", barrier.GetAddr());
if (!barrier)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (barrier.GetAddr() % 4)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncBarrierWait(mem_ptr_t<CellSyncBarrier> barrier)
{
cellSync->Todo("cellSyncBarrierWait(barrier_addr=0x%x)", barrier.GetAddr());
if (!barrier)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (barrier.GetAddr() % 4)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncBarrierTryWait(mem_ptr_t<CellSyncBarrier> barrier)
{
cellSync->Todo("cellSyncBarrierTryWait(barrier_addr=0x%x)", barrier.GetAddr());
if (!barrier)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (barrier.GetAddr() % 4)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncRwmInitialize(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr, u32 buffer_size)
{
cellSync->Log("cellSyncRwmInitialize(rwm_addr=0x%x, buffer_addr=0x%x, buffer_size=0x%x)", rwm.GetAddr(), buffer_addr, buffer_size);
if (!rwm || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (rwm.GetAddr() % 16 || buffer_addr % 128)
{
return CELL_SYNC_ERROR_ALIGN;
}
if (buffer_size % 128 || buffer_size > 0x4000)
{
return CELL_SYNC_ERROR_INVAL;
}
// prx: zeroize first u16 and second u16, write buffer_size in second u32, write buffer_addr in second u64 and sync
rwm->m_data() = 0;
rwm->m_size = buffer_size;
rwm->m_addr = (u64)buffer_addr;
InterlockedCompareExchange(&rwm->m_data(), 0, 0);
return CELL_OK;
}
s32 cellSyncRwmRead(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
{
cellSync->Log("cellSyncRwmRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
if (!rwm || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (rwm.GetAddr() % 16)
{
return CELL_SYNC_ERROR_ALIGN;
}
// prx: atomically load first u32, repeat until second u16 == 0, increase first u16 and sync
while (true)
{
const u32 old_data = rwm->m_data();
CellSyncRwm new_rwm;
new_rwm.m_data() = old_data;
if (new_rwm.m_writers.ToBE())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncRwmRead(rwm_addr=0x%x) aborted", rwm.GetAddr());
return CELL_OK;
}
continue;
}
new_rwm.m_readers++;
if (InterlockedCompareExchange(&rwm->m_data(), new_rwm.m_data(), old_data) == old_data) break;
}
// copy data to buffer_addr
memcpy(Memory + buffer_addr, Memory + (u64)rwm->m_addr, (u32)rwm->m_size);
// prx: load first u32, return 0x8041010C if first u16 == 0, atomically decrease it
while (true)
{
const u32 old_data = rwm->m_data();
CellSyncRwm new_rwm;
new_rwm.m_data() = old_data;
if (!new_rwm.m_readers.ToBE())
{
cellSync->Error("cellSyncRwmRead(rwm_addr=0x%x): m_readers == 0 (m_writers=%d)", rwm.GetAddr(), (u16)new_rwm.m_writers);
return CELL_SYNC_ERROR_ABORT;
}
new_rwm.m_readers--;
if (InterlockedCompareExchange(&rwm->m_data(), new_rwm.m_data(), old_data) == old_data) break;
}
return CELL_OK;
}
s32 cellSyncRwmTryRead(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
{
cellSync->Todo("cellSyncRwmTryRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
if (!rwm || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (rwm.GetAddr() % 16)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncRwmWrite(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
{
cellSync->Todo("cellSyncRwmWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
if (!rwm || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (rwm.GetAddr() % 16)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncRwmTryWrite(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
{
cellSync->Todo("cellSyncRwmTryWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
if (!rwm || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (rwm.GetAddr() % 16)
{
return CELL_SYNC_ERROR_ALIGN;
}
// TODO
return CELL_OK;
}
s32 cellSyncQueueInitialize(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr, u32 size, u32 depth)
{
cellSync->Log("cellSyncQueueInitialize(queue_addr=0x%x, buffer_addr=0x%x, size=0x%x, depth=0x%x)", queue.GetAddr(), buffer_addr, size, depth);
if (!queue)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (size && !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32 || buffer_addr % 16)
{
return CELL_SYNC_ERROR_ALIGN;
}
if (!depth || size % 16)
{
return CELL_SYNC_ERROR_INVAL;
}
// prx: zeroize first u64, write size in third u32, write depth in fourth u32, write address in third u64 and sync
queue->m_data() = 0;
queue->m_size = size;
queue->m_depth = depth;
queue->m_addr = (u64)buffer_addr;
InterlockedCompareExchange(&queue->m_data(), 0, 0);
return CELL_OK;
}
s32 cellSyncQueuePush(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Log("cellSyncQueuePush(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
if (!queue || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 size = (u32)queue->m_size;
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || ((u32)queue->m_v2 & 0xffffff) > depth)
{
cellSync->Error("cellSyncQueuePush(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
u32 position;
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v1 = (u32)new_queue.m_v1;
const u32 v2 = (u32)new_queue.m_v2;
// prx: compare 5th u8 with zero (repeat if not zero)
// prx: compare (second u32 (u24) + first u8) with depth (repeat if greater or equal)
if ((v2 >> 24) || ((v2 & 0xffffff) + (v1 >> 24)) >= depth)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueuePush(queue_addr=0x%x) aborted", queue.GetAddr());
return CELL_OK;
}
continue;
}
// prx: extract first u32 (u24) (-> position), calculate (position + 1) % depth, insert it back
// prx: insert 1 in 5th u8
// prx: extract second u32 (u24), increase it, insert it back
position = (v1 & 0xffffff);
new_queue.m_v1 = (v1 & 0xff000000) | ((position + 1) % depth);
new_queue.m_v2 = (1 << 24) | ((v2 & 0xffffff) + 1);
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
// prx: memcpy(position * m_size + m_addr, buffer_addr, m_size), sync
memcpy(Memory + (u64)queue->m_addr + position * size, Memory + buffer_addr, size);
// prx: atomically insert 0 in 5th u8
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
new_queue.m_v2 &= 0xffffff; // TODO: use InterlockedAnd() or something
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
return CELL_OK;
}
s32 cellSyncQueueTryPush(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Log("cellSyncQueueTryPush(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
if (!queue || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 size = (u32)queue->m_size;
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || ((u32)queue->m_v2 & 0xffffff) > depth)
{
cellSync->Error("cellSyncQueueTryPush(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
u32 position;
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v1 = (u32)new_queue.m_v1;
const u32 v2 = (u32)new_queue.m_v2;
if ((v2 >> 24) || ((v2 & 0xffffff) + (v1 >> 24)) >= depth)
{
return CELL_SYNC_ERROR_BUSY;
}
position = (v1 & 0xffffff);
new_queue.m_v1 = (v1 & 0xff000000) | ((position + 1) % depth);
new_queue.m_v2 = (1 << 24) | ((v2 & 0xffffff) + 1);
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
memcpy(Memory + (u64)queue->m_addr + position * size, Memory + buffer_addr, size);
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
new_queue.m_v2 &= 0xffffff; // TODO: use InterlockedAnd() or something
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
return CELL_OK;
}
s32 cellSyncQueuePop(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Log("cellSyncQueuePop(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
if (!queue || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 size = (u32)queue->m_size;
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || ((u32)queue->m_v2 & 0xffffff) > depth)
{
cellSync->Error("cellSyncQueuePop(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
u32 position;
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v1 = (u32)new_queue.m_v1;
const u32 v2 = (u32)new_queue.m_v2;
// prx: extract first u8, repeat if not zero
// prx: extract second u32 (u24), subtract 5th u8, compare with zero, repeat if less or equal
if ((v1 >> 24) || ((v2 & 0xffffff) <= (v2 >> 24)))
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueuePop(queue_addr=0x%x) aborted", queue.GetAddr());
return CELL_OK;
}
continue;
}
// prx: insert 1 in first u8
// prx: extract first u32 (u24), add depth, subtract second u32 (u24), calculate (% depth), save to position
// prx: extract second u32 (u24), decrease it, insert it back
new_queue.m_v1 = 0x1000000 | v1;
position = ((v1 & 0xffffff) + depth - (v2 & 0xffffff)) % depth;
new_queue.m_v2 = (v2 & 0xff000000) | ((v2 & 0xffffff) - 1);
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
// prx: (sync), memcpy(buffer_addr, position * m_size + m_addr, m_size)
memcpy(Memory + buffer_addr, Memory + (u64)queue->m_addr + position * size, size);
// prx: atomically insert 0 in first u8
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
new_queue.m_v1 &= 0xffffff; // TODO: use InterlockedAnd() or something
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
return CELL_OK;
}
s32 cellSyncQueueTryPop(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Log("cellSyncQueueTryPop(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
if (!queue || !buffer_addr)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 size = (u32)queue->m_size;
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || ((u32)queue->m_v2 & 0xffffff) > depth)
{
cellSync->Error("cellSyncQueueTryPop(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
u32 position;
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v1 = (u32)new_queue.m_v1;
const u32 v2 = (u32)new_queue.m_v2;
if ((v1 >> 24) || ((v2 & 0xffffff) <= (v2 >> 24)))
{
return CELL_SYNC_ERROR_BUSY;
}
new_queue.m_v1 = 0x1000000 | v1;
position = ((v1 & 0xffffff) + depth - (v2 & 0xffffff)) % depth;
new_queue.m_v2 = (v2 & 0xff000000) | ((v2 & 0xffffff) - 1);
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
memcpy(Memory + buffer_addr, Memory + (u64)queue->m_addr + position * size, size);
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
new_queue.m_v1 &= 0xffffff; // TODO: use InterlockedAnd() or something
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
return CELL_OK;
}
s32 cellSyncQueuePeek(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Todo("cellSyncQueuePeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
return CELL_OK;
}
s32 cellSyncQueueTryPeek(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
{
cellSync->Todo("cellSyncQueueTryPeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
return CELL_OK;
}
s32 cellSyncQueueSize(mem_ptr_t<CellSyncQueue> queue)
{
cellSync->Log("cellSyncQueueSize(queue_addr=0x%x)", queue.GetAddr());
if (!queue)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 count = (u32)queue->m_v2 & 0xffffff;
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || count > depth)
{
cellSync->Error("cellSyncQueueSize(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
return count;
}
s32 cellSyncQueueClear(mem_ptr_t<CellSyncQueue> queue)
{
cellSync->Log("cellSyncQueueClear(queue_addr=0x%x)", queue.GetAddr());
if (!queue)
{
return CELL_SYNC_ERROR_NULL_POINTER;
}
if (queue.GetAddr() % 32)
{
return CELL_SYNC_ERROR_ALIGN;
}
const u32 depth = (u32)queue->m_depth;
if (((u32)queue->m_v1 & 0xffffff) > depth || ((u32)queue->m_v2 & 0xffffff) > depth)
{
cellSync->Error("cellSyncQueueSize(queue_addr=0x%x): m_depth limit broken", queue.GetAddr());
Emu.Pause();
}
// TODO: optimize if possible
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v1 = (u32)new_queue.m_v1;
// prx: extract first u8, repeat if not zero, insert 1
if (v1 >> 24)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueueClear(queue_addr=0x%x) aborted (I)", queue.GetAddr());
return CELL_OK;
}
continue;
}
new_queue.m_v1 = v1 | 0x1000000;
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
while (true)
{
const u64 old_data = queue->m_data();
CellSyncQueue new_queue;
new_queue.m_data() = old_data;
const u32 v2 = (u32)new_queue.m_v2;
// prx: extract 5th u8, repeat if not zero, insert 1
if (v2 >> 24)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
cellSync->Warning("cellSyncQueueClear(queue_addr=0x%x) aborted (II)", queue.GetAddr());
return CELL_OK;
}
continue;
}
new_queue.m_v2 = v2 | 0x1000000;
if (InterlockedCompareExchange(&queue->m_data(), new_queue.m_data(), old_data) == old_data) break;
}
queue->m_data() = 0;
InterlockedCompareExchange(&queue->m_data(), 0, 0);
return CELL_OK;
}
void cellSync_init()
{
cellSync->AddFunc(0xa9072dee, cellSyncMutexInitialize);
cellSync->AddFunc(0x1bb675c2, cellSyncMutexLock);
cellSync->AddFunc(0xd06918c4, cellSyncMutexTryLock);
cellSync->AddFunc(0x91f2b7b0, cellSyncMutexUnlock);
cellSync->AddFunc(0x07254fda, cellSyncBarrierInitialize);
cellSync->AddFunc(0xf06a6415, cellSyncBarrierNotify);
cellSync->AddFunc(0x268edd6d, cellSyncBarrierTryNotify);
cellSync->AddFunc(0x35f21355, cellSyncBarrierWait);
cellSync->AddFunc(0x6c272124, cellSyncBarrierTryWait);
cellSync->AddFunc(0xfc48b03f, cellSyncRwmInitialize);
cellSync->AddFunc(0xcece771f, cellSyncRwmRead);
cellSync->AddFunc(0xa6669751, cellSyncRwmTryRead);
cellSync->AddFunc(0xed773f5f, cellSyncRwmWrite);
cellSync->AddFunc(0xba5bee48, cellSyncRwmTryWrite);
cellSync->AddFunc(0x3929948d, cellSyncQueueInitialize);
cellSync->AddFunc(0x5ae841e5, cellSyncQueuePush);
cellSync->AddFunc(0x705985cd, cellSyncQueueTryPush);
cellSync->AddFunc(0x4da6d7e0, cellSyncQueuePop);
cellSync->AddFunc(0xa58df87f, cellSyncQueueTryPop);
cellSync->AddFunc(0x48154c9b, cellSyncQueuePeek);
cellSync->AddFunc(0x68af923c, cellSyncQueueTryPeek);
cellSync->AddFunc(0x4da349b2, cellSyncQueueSize);
cellSync->AddFunc(0xa5362e73, cellSyncQueueClear);
}

View File

@ -0,0 +1,88 @@
#pragma once
// Return Codes
enum
{
CELL_SYNC_ERROR_AGAIN = 0x80410101,
CELL_SYNC_ERROR_INVAL = 0x80410102,
CELL_SYNC_ERROR_NOSYS = 0x80410103, // ???
CELL_SYNC_ERROR_NOMEM = 0x80410104,
CELL_SYNC_ERROR_SRCH = 0x80410105, // ???
CELL_SYNC_ERROR_NOENT = 0x80410106, // ???
CELL_SYNC_ERROR_NOEXEC = 0x80410107, // ???
CELL_SYNC_ERROR_DEADLK = 0x80410108,
CELL_SYNC_ERROR_PERM = 0x80410109,
CELL_SYNC_ERROR_BUSY = 0x8041010A,
//////////////////////// 0x8041010B, // ???
CELL_SYNC_ERROR_ABORT = 0x8041010C, // ???
CELL_SYNC_ERROR_FAULT = 0x8041010D, // ???
CELL_SYNC_ERROR_CHILD = 0x8041010E, // ???
CELL_SYNC_ERROR_STAT = 0x8041010F,
CELL_SYNC_ERROR_ALIGN = 0x80410110,
CELL_SYNC_ERROR_NULL_POINTER = 0x80410111,
CELL_SYNC_ERROR_NOT_SUPPORTED_THREAD = 0x80410112, // ???
CELL_SYNC_ERROR_SHOTAGE = 0x80410112, // ???
CELL_SYNC_ERROR_NO_NOTIFIER = 0x80410113, // ???
CELL_SYNC_ERROR_UNKNOWNKEY = 0x80410113, // ???
CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410114, // ???
};
struct CellSyncMutex
{
be_t<u16> m_freed;
be_t<u16> m_order;
volatile u32& m_data()
{
return *reinterpret_cast<u32*>(this);
};
};
static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong size");
struct CellSyncBarrier
{
be_t<u16> m_value;
be_t<u16> m_count;
volatile u32& m_data()
{
return *reinterpret_cast<u32*>(this);
};
};
static_assert(sizeof(CellSyncBarrier) == 4, "CellSyncBarrier: wrong size");
struct CellSyncRwm
{
be_t<u16> m_readers;
be_t<u16> m_writers;
be_t<u32> m_size;
be_t<u64> m_addr;
volatile u32& m_data()
{
return *reinterpret_cast<u32*>(this);
};
};
static_assert(sizeof(CellSyncRwm) == 16, "CellSyncBarrier: wrong size");
struct CellSyncQueue
{
be_t<u32> m_v1;
be_t<u32> m_v2;
be_t<u32> m_size;
be_t<u32> m_depth;
be_t<u64> m_addr;
be_t<u64> reserved;
volatile u64& m_data()
{
return *reinterpret_cast<u64*>(this);
};
};
static_assert(sizeof(CellSyncQueue) == 32, "CellSyncQueue: wrong size");

View File

@ -156,7 +156,7 @@ int cellSysmoduleFinalize()
int cellSysmoduleSetMemcontainer(u32 ct_id)
{
cellSysmodule->Warning("TODO: cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id);
cellSysmodule->Todo("cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id);
return CELL_OK;
}
@ -164,7 +164,7 @@ int cellSysmoduleLoadModule(u16 id)
{
if (id == 0xf054)
{
cellSysmodule->Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI");
cellSysmodule->Todo("cellSysmoduleLoadModule: CELL_SYSMODULE_LIBATRAC3MULTI");
}
cellSysmodule->Warning("cellSysmoduleLoadModule(%s)", getModuleName(id));

View File

@ -575,7 +575,7 @@ int cellAudioOutGetNumberOfDevice(u32 audioOut)
int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_t<CellAudioOutDeviceInfo> info)
{
cellSysutil->Error("Unimplemented function: cellAudioOutGetDeviceInfo(audioOut=%u, deviceIndex=%u, info_addr=0x%x)",
cellSysutil->Todo("Unimplemented function: cellAudioOutGetDeviceInfo(audioOut=%u, deviceIndex=%u, info_addr=0x%x)",
audioOut, deviceIndex, info.GetAddr());
if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;

View File

@ -108,8 +108,8 @@ u32 vdecQueryAttr(CellVdecCodecType type, u32 profile, u32 spec_addr /* may be 0
switch (type) // TODO: check profile levels
{
case CELL_VDEC_CODEC_TYPE_AVC: cellVdec->Warning("cellVdecQueryAttr: AVC (profile=%d)", profile); break;
case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec->Error("TODO: MPEG2 not supported"); break;
case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec->Error("TODO: DIVX not supported"); break;
case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec->Todo("MPEG2 not supported"); break;
case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec->Todo("DIVX not supported"); break;
default: return CELL_VDEC_ERROR_ARG;
}
@ -620,13 +620,13 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR)
{
cellVdec->Error("cellVdecGetPicture: TODO: unknown formatType(%d)", (u32)format->formatType);
cellVdec->Todo("cellVdecGetPicture: unknown formatType(%d)", (u32)format->formatType);
return CELL_OK;
}
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709)
{
cellVdec->Error("cellVdecGetPicture: TODO: unknown colorMatrixType(%d)", (u32)format->colorMatrixType);
cellVdec->Todo("cellVdecGetPicture: unknown colorMatrixType(%d)", (u32)format->colorMatrixType);
return CELL_OK;
}

View File

@ -532,7 +532,7 @@ int cellSurMixerStart()
int cellSurMixerSetParameter(u32 param, float value)
{
declCPU();
libmixer->Error("cellSurMixerSetParameter(param=0x%x, value=%f, FPR[1]=%f, FPR[2]=%f)", param, value, (float&)CPU.FPR[1], (float&)CPU.FPR[2]);
libmixer->Todo("cellSurMixerSetParameter(param=0x%x, value=%f, FPR[1]=%f, FPR[2]=%f)", param, value, (float&)CPU.FPR[1], (float&)CPU.FPR[2]);
return CELL_OK;
}
@ -560,7 +560,7 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, u32 addr, u32 samples)
}
else
{
libmixer->Error("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d): unknown parameters", busNo, offset, addr, samples);
libmixer->Todo("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples);
return CELL_OK;
}
@ -578,7 +578,7 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, u32 addr, u32 samples)
int cellSurMixerChStripSetParameter(u32 type, u32 index, mem_ptr_t<CellSurMixerChStripParam> param)
{
libmixer->Error("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.GetAddr());
libmixer->Todo("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.GetAddr());
return CELL_OK;
}
@ -614,14 +614,14 @@ int cellSurMixerGetTimestamp(u64 tag, mem64_t stamp)
void cellSurMixerBeep(u32 arg)
{
libmixer->Error("cellSurMixerBeep(arg=%d)", arg);
libmixer->Todo("cellSurMixerBeep(arg=%d)", arg);
return;
}
void cellSurMixerUtilGetLevelFromDB(float dB)
{
// not hooked, probably unnecessary
libmixer->Error("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
libmixer->Todo("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
declCPU();
(float&)CPU.FPR[0] = 0.0f;
}
@ -629,7 +629,7 @@ void cellSurMixerUtilGetLevelFromDB(float dB)
void cellSurMixerUtilGetLevelFromDBIndex(int index)
{
// not hooked, probably unnecessary
libmixer->Error("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
libmixer->Todo("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
declCPU();
(float&)CPU.FPR[0] = 0.0f;
}
@ -637,7 +637,7 @@ void cellSurMixerUtilGetLevelFromDBIndex(int index)
void cellSurMixerUtilNoteToRatio(u8 refNote, u8 note)
{
// not hooked, probably unnecessary
libmixer->Error("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
libmixer->Todo("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
declCPU();
(float&)CPU.FPR[0] = 0.0f;
}
@ -1206,7 +1206,7 @@ void libmixer_init()
0xf000000048000000 // b
);
REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB);
REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex);
REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio);
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB, 0);
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex, 0);
REG_SUB(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio, 0);
}

View File

@ -10,103 +10,103 @@ Module libsynth2("libsynth2", libsynth2_init);
int cellSoundSynth2Config(s16 param, int value)
{
libsynth2.Error("cellSoundSynth2Config(param=%d, value=%d)", param, value);
libsynth2.Todo("cellSoundSynth2Config(param=%d, value=%d)", param, value);
return CELL_OK;
}
int cellSoundSynth2Init(s16 flag)
{
libsynth2.Error("cellSoundSynth2Init(flag=%d)", flag);
libsynth2.Todo("cellSoundSynth2Init(flag=%d)", flag);
return CELL_OK;
}
int cellSoundSynth2Exit()
{
libsynth2.Error("cellSoundSynth2Exit()");
libsynth2.Todo("cellSoundSynth2Exit()");
return CELL_OK;
}
void cellSoundSynth2SetParam(u16 reg, u16 value)
{
libsynth2.Error("cellSoundSynth2SetParam(register=0x%x, value=0x%x)", reg, value);
libsynth2.Todo("cellSoundSynth2SetParam(register=0x%x, value=0x%x)", reg, value);
}
u16 cellSoundSynth2GetParam(u16 reg)
{
libsynth2.Error("cellSoundSynth2GetParam(register=0x%x) -> 0", reg);
libsynth2.Todo("cellSoundSynth2GetParam(register=0x%x) -> 0", reg);
return 0;
}
void cellSoundSynth2SetSwitch(u16 reg, u32 value)
{
libsynth2.Error("cellSoundSynth2SetSwitch(register=0x%x, value=0x%x)", reg, value);
libsynth2.Todo("cellSoundSynth2SetSwitch(register=0x%x, value=0x%x)", reg, value);
}
u32 cellSoundSynth2GetSwitch(u16 reg)
{
libsynth2.Error("cellSoundSynth2GetSwitch(register=0x%x) -> 0", reg);
libsynth2.Todo("cellSoundSynth2GetSwitch(register=0x%x) -> 0", reg);
return 0;
}
int cellSoundSynth2SetAddr(u16 reg, u32 value)
{
libsynth2.Error("cellSoundSynth2SetAddr(register=0x%x, value=0x%x)", reg, value);
libsynth2.Todo("cellSoundSynth2SetAddr(register=0x%x, value=0x%x)", reg, value);
return CELL_OK;
}
u32 cellSoundSynth2GetAddr(u16 reg)
{
libsynth2.Error("cellSoundSynth2GetAddr(register=0x%x) -> 0", reg);
libsynth2.Todo("cellSoundSynth2GetAddr(register=0x%x) -> 0", reg);
return 0;
}
int cellSoundSynth2SetEffectAttr(s16 bus, mem_ptr_t<CellSoundSynth2EffectAttr> attr)
{
libsynth2.Error("cellSoundSynth2SetEffectAttr(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr());
libsynth2.Todo("cellSoundSynth2SetEffectAttr(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr());
return CELL_OK;
}
int cellSoundSynth2SetEffectMode(s16 bus, mem_ptr_t<CellSoundSynth2EffectAttr> attr)
{
libsynth2.Error("cellSoundSynth2SetEffectMode(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr());
libsynth2.Todo("cellSoundSynth2SetEffectMode(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr());
return CELL_OK;
}
void cellSoundSynth2SetCoreAttr(u16 entry, u16 value)
{
libsynth2.Error("cellSoundSynth2SetCoreAttr(entry=0x%x, value=0x%x)", entry, value);
libsynth2.Todo("cellSoundSynth2SetCoreAttr(entry=0x%x, value=0x%x)", entry, value);
}
int cellSoundSynth2Generate(u16 samples, u32 L_addr, u32 R_addr, u32 Lr_addr, u32 Rr_addr)
{
libsynth2.Error("cellSoundSynth2Generate(samples=0x%x, left=0x%x, right=0x%x, left_rear=0x%x, right_rear=0x%x)",
libsynth2.Todo("cellSoundSynth2Generate(samples=0x%x, left=0x%x, right=0x%x, left_rear=0x%x, right_rear=0x%x)",
samples, L_addr, R_addr, Lr_addr, Rr_addr);
return CELL_OK;
}
int cellSoundSynth2VoiceTrans(s16 channel, u16 mode, u32 mem_side_addr, u32 lib_side_addr, u32 size)
{
libsynth2.Error("cellSoundSynth2VoiceTrans(channel=%d, mode=0x%x, m_addr=0x%x, s_addr=0x%x, size=0x%x)",
libsynth2.Todo("cellSoundSynth2VoiceTrans(channel=%d, mode=0x%x, m_addr=0x%x, s_addr=0x%x, size=0x%x)",
channel, mode, mem_side_addr, lib_side_addr, size);
return CELL_OK;
}
int cellSoundSynth2VoiceTransStatus(s16 channel, s16 flag)
{
libsynth2.Error("cellSoundSynth2VoiceTransStatus(channel=%d, flag=%d)", channel, flag);
libsynth2.Todo("cellSoundSynth2VoiceTransStatus(channel=%d, flag=%d)", channel, flag);
return CELL_OK;
}
u16 cellSoundSynth2Note2Pitch(u16 center_note, u16 center_fine, u16 note, s16 fine)
{
libsynth2.Error("cellSoundSynth2Note2Pitch(center_note=0x%x, center_fine=0x%x, note=0x%x, fine=%d) -> 0",
libsynth2.Todo("cellSoundSynth2Note2Pitch(center_note=0x%x, center_fine=0x%x, note=0x%x, fine=%d) -> 0",
center_note, center_fine, note, fine);
return 0;
}
u16 cellSoundSynth2Pitch2Note(u16 center_note, u16 center_fine, u16 pitch)
{
libsynth2.Error("cellSoundSynth2Pitch2Note(center_note=0x%x, center_fine=0x%x, pitch=0x%x) -> 0",
libsynth2.Todo("cellSoundSynth2Pitch2Note(center_note=0x%x, center_fine=0x%x, pitch=0x%x) -> 0",
center_note, center_fine, pitch);
return 0;
}

View File

@ -77,11 +77,10 @@ s64 sys_process_at_Exitspawn()
int sys_process_is_stack(u32 p)
{
PPCThread* CPU = GetCurrentPPCThread();
if (p >= CPU->GetStackAddr() && p <= CPU->GetStackAddr() + CPU->GetStackSize())
return 1;
sysPrxForUser->Log("sys_process_is_stack(p=0x%x)", p);
return 0;
// prx: compare high 4 bits with "0xD"
return (int)(bool)(p >= Memory.StackMem.GetStartAddr() && p <= Memory.StackMem.GetEndAddr());
}
int sys_spu_printf_initialize(int a1, int a2, int a3, int a4, int a5)

View File

@ -28,7 +28,7 @@ static func_caller* sc_table[kSyscallTableLength] =
null_func,
bind_func(sys_process_getpid), //1 (0x001)
bind_func(sys_process_wait_for_child), //2 (0x002) ROOT
bind_func(sys_process_exit), //3 (0x003)
null_func,//bind_func(sys_process_exit), //3 (0x003)
bind_func(sys_process_get_status), //4 (0x004) DBG
bind_func(sys_process_detach_child), //5 (0x005) DBG
@ -57,7 +57,7 @@ static func_caller* sc_table[kSyscallTableLength] =
null_func, null_func, null_func, null_func, null_func, null_func, null_func, null_func, null_func, //32-40 UNS
bind_func(sys_ppu_thread_exit), //41 (0x029)
bind_func(sys_internal_ppu_thread_exit), //41 (0x029)
null_func, //42 (0x02A) UNS
bind_func(sys_ppu_thread_yield), //43 (0x02B)
bind_func(sys_ppu_thread_join), //44 (0x02C)
@ -66,9 +66,9 @@ static func_caller* sc_table[kSyscallTableLength] =
bind_func(sys_ppu_thread_set_priority), //47 (0x02F) DBG
bind_func(sys_ppu_thread_get_priority), //48 (0x030)
bind_func(sys_ppu_thread_get_stack_information), //49 (0x031)
bind_func(sys_ppu_thread_stop), //50 (0x032) ROOT
bind_func(sys_ppu_thread_restart), //51 (0x033) ROOT
bind_func(sys_ppu_thread_create), //52 (0x034) DBG
null_func,//bind_func(sys_ppu_thread_stop), //50 (0x032) ROOT
null_func,//bind_func(sys_ppu_thread_restart), //51 (0x033) ROOT
null_func,//bind_func(sys_ppu_thread_create), //52 (0x034) DBG
null_func,//bind_func(sys_ppu_thread_start), //53 (0x035)
null_func,//bind_func(sys_ppu_...), //54 (0x036) ROOT
null_func,//bind_func(sys_ppu_...), //55 (0x037) ROOT
@ -111,11 +111,11 @@ static func_caller* sc_table[kSyscallTableLength] =
bind_func(sys_semaphore_wait), //92 (0x05C)
bind_func(sys_semaphore_trywait), //93 (0x05D)
bind_func(sys_semaphore_post), //94 (0x05E)
bind_func(sys_lwmutex_create), //95 (0x05F)
bind_func(sys_lwmutex_destroy), //96 (0x060)
bind_func(sys_lwmutex_lock), //97 (0x061)
bind_func(sys_lwmutex_trylock), //98 (0x062)
bind_func(sys_lwmutex_unlock), //99 (0x063)
null_func,//bind_func(sys_lwmutex_create), //95 (0x05F)
null_func,//bind_func(sys_lwmutex_destroy), //96 (0x060)
null_func,//bind_func(sys_lwmutex_lock), //97 (0x061)
null_func,//bind_func(sys_lwmutex_trylock), //98 (0x062)
null_func,//bind_func(sys_lwmutex_unlock), //99 (0x063)
bind_func(sys_mutex_create), //100 (0x064)
bind_func(sys_mutex_destroy), //101 (0x065)
bind_func(sys_mutex_lock), //102 (0x066)
@ -162,7 +162,7 @@ static func_caller* sc_table[kSyscallTableLength] =
null_func,//bind_func(sys_time_set_timezone) //143 (0x08F) ROOT
bind_func(sys_time_get_timezone), //144 (0x090)
bind_func(sys_time_get_current_time), //145 (0x091)
bind_func(sys_time_get_system_time), //146 (0x092) ROOT
null_func,//bind_func(sys_time_get_system_time), //146 (0x092) ROOT
bind_func(sys_time_get_timebase_frequency), //147 (0x093)
null_func,//bind_func(sys_rwlock_trywlock) //148 (0x094)
null_func, //149 (0x095) UNS
@ -419,24 +419,24 @@ static func_caller* sc_table[kSyscallTableLength] =
null_func, null_func, null_func, //477-479 UNS
bind_func(sys_prx_load_module), //480 (0x1E0)
bind_func(sys_prx_start_module), //481 (0x1E1)
bind_func(sys_prx_stop_module), //482 (0x1E2)
bind_func(sys_prx_unload_module), //483 (0x1E3)
bind_func(sys_prx_register_module), //484 (0x1E4)
null_func,//bind_func(sys_prx_load_module), //480 (0x1E0)
null_func,//bind_func(sys_prx_start_module), //481 (0x1E1)
null_func,//bind_func(sys_prx_stop_module), //482 (0x1E2)
null_func,//bind_func(sys_prx_unload_module), //483 (0x1E3)
null_func,//bind_func(sys_prx_register_module), //484 (0x1E4)
bind_func(sys_prx_query_module), //485 (0x1E5)
bind_func(sys_prx_register_library), //486 (0x1E6)
bind_func(sys_prx_unregister_library), //487 (0x1E7)
null_func,//bind_func(sys_prx_unregister_library), //487 (0x1E7)
bind_func(sys_prx_link_library), //488 (0x1E8)
bind_func(sys_prx_unlink_library), //489 (0x1E9)
bind_func(sys_prx_query_library), //490 (0x1EA)
null_func, //491 (0x1EB) UNS
null_func,//bind_func(sys_...) //492 (0x1EC) DBG
null_func,//bind_func(sys_prx_dbg_get_module_info) //493 (0x1ED) DBG
bind_func(sys_prx_get_module_list), //494 (0x1EE)
bind_func(sys_prx_get_module_info), //495 (0x1EF)
bind_func(sys_prx_get_module_id_by_name), //496 (0x1F0)
bind_func(sys_prx_load_module_on_memcontainer), //497 (0x1F1)
null_func,//bind_func(sys_prx_get_module_list), //494 (0x1EE)
null_func,//bind_func(sys_prx_get_module_info), //495 (0x1EF)
null_func,//bind_func(sys_prx_get_module_id_by_name), //496 (0x1F0)
null_func,//bind_func(sys_prx_load_module_on_memcontainer),//497 (0x1F1)
bind_func(sys_prx_start), //498 (0x1F2)
bind_func(sys_prx_stop), //499 (0x1F3)
null_func,//bind_func(sys_hid_manager_open) //500 (0x1F4)

View File

@ -30,6 +30,7 @@
#include "Emu/Event.h"
#include "rpcs3/Ini.h"
#include "LogBase.h"
//#define SYSCALLS_DEBUG
@ -49,7 +50,7 @@ namespace detail{
template<> bool CheckId<ID>(u32 id, ID*& _id,const std::string &name);
}
class SysCallBase //Module
class SysCallBase : public LogBase
{
private:
std::string m_module_name;
@ -62,64 +63,9 @@ public:
{
}
const std::string& GetName() const { return m_module_name; }
void Log(const u32 id, std::string fmt, ...)
virtual const std::string& GetName() const override
{
if(Ini.HLELogging.GetValue())
{
va_list list;
va_start(list, fmt);
LOG_NOTICE(HLE, GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list));
va_end(list);
}
}
void Log(std::string fmt, ...)
{
if(Ini.HLELogging.GetValue())
{
va_list list;
va_start(list, fmt);
LOG_NOTICE(HLE, GetName() + ": " + fmt::FormatV(fmt, list));
va_end(list);
}
}
void Warning(const u32 id, std::string fmt, ...)
{
//#ifdef SYSCALLS_DEBUG
va_list list;
va_start(list, fmt);
LOG_WARNING(HLE, GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list));
va_end(list);
//#endif
}
void Warning(std::string fmt, ...)
{
//#ifdef SYSCALLS_DEBUG
va_list list;
va_start(list, fmt);
LOG_WARNING(HLE, GetName() + " warning: " + fmt::FormatV(fmt, list));
va_end(list);
//#endif
}
void Error(const u32 id, std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_ERROR(HLE, GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list));
va_end(list);
}
void Error(std::string fmt, ...)
{
va_list list;
va_start(list, fmt);
LOG_ERROR(HLE, GetName() + " error: " + fmt::FormatV(fmt, list));
va_end(list);
return m_module_name;
}
bool CheckId(u32 id) const
@ -143,7 +89,7 @@ public:
extern int cellGcmCallback(u32 context_addr, u32 count);
#define UNIMPLEMENTED_FUNC(module) module->Error("Unimplemented function: %s", __FUNCTION__)
#define UNIMPLEMENTED_FUNC(module) module->Todo("%s", __FUNCTION__)
#define SC_ARG_0 CPU.GPR[3]
#define SC_ARG_1 CPU.GPR[4]
@ -187,7 +133,3 @@ public:
#define REG_SUB(module, group, name, ...) \
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
module->AddFuncSub(group, name ## _table, #name, name)
#define REG_SUB_EMPTY(module, group, name,...) \
static const u64 name ## _table[] = {0}; \
module->AddFuncSub(group, name ## _table, #name, name)

View File

@ -620,7 +620,7 @@ s32 cellFsStReadGetRegid(u32 fd, mem64_t regid)
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
{
sys_fs->Warning("TODO: cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size);
sys_fs->Todo("cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -645,7 +645,7 @@ s32 cellFsStReadStop(u32 fd)
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
{
sys_fs->Warning("TODO: cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr());
sys_fs->Todo("cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -660,7 +660,7 @@ s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
{
sys_fs->Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -672,7 +672,7 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
{
sys_fs->Warning("TODO: cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size);
sys_fs->Todo("cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -684,7 +684,7 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
s32 cellFsStReadWait(u32 fd, u64 size)
{
sys_fs->Warning("TODO: cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size);
sys_fs->Todo("cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -694,7 +694,7 @@ s32 cellFsStReadWait(u32 fd, u64 size)
s32 cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func)
{
sys_fs->Warning("TODO: cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr());
sys_fs->Todo("cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr());
if (!func.IsGood())
return CELL_EFAULT;

View File

@ -66,7 +66,7 @@ s32 sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> at
s32 sys_event_queue_destroy(u32 equeue_id, int mode)
{
sys_event.Error("sys_event_queue_destroy(equeue_id=%d, mode=0x%x)", equeue_id, mode);
sys_event.Todo("sys_event_queue_destroy(equeue_id=%d, mode=0x%x)", equeue_id, mode);
EventQueue* eq;
if (!Emu.GetIdManager().GetIDData(equeue_id, eq))
@ -111,7 +111,7 @@ s32 sys_event_queue_destroy(u32 equeue_id, int mode)
s32 sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_array, int size, mem32_t number)
{
sys_event.Error("sys_event_queue_tryreceive(equeue_id=%d, event_array_addr=0x%x, size=%d, number_addr=0x%x)",
sys_event.Todo("sys_event_queue_tryreceive(equeue_id=%d, event_array_addr=0x%x, size=%d, number_addr=0x%x)",
equeue_id, event_array.GetAddr(), size, number.GetAddr());
if (size < 0 || !number.IsGood())
@ -403,8 +403,8 @@ s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr,
switch (attr->protocol.ToBE())
{
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_RETRY): sys_event.Warning("TODO: SYS_SYNC_RETRY attr"); break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
case se32(SYS_SYNC_RETRY): sys_event.Todo("sys_event_flag_create(): SYS_SYNC_RETRY"); break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event.Todo("sys_event_flag_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_FIFO): break;
default: return CELL_EINVAL;
}

View File

@ -83,7 +83,7 @@ s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64
s32 sys_interrupt_thread_disestablish(u32 ih)
{
sc_int.Error("sys_interrupt_thread_disestablish(ih=%d)", ih);
sc_int.Todo("sys_interrupt_thread_disestablish(ih=%d)", ih);
CPUThread* it = Emu.GetCPU().GetThread(ih);
if (!it)

View File

@ -22,8 +22,8 @@ s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mtx.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT protocol"); break;
case se32(SYS_SYNC_RETRY): sys_mtx.Error("Invalid SYS_SYNC_RETRY protocol"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mtx.Todo("sys_mutex_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_mtx.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL;
default: sys_mtx.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
}

View File

@ -10,12 +10,10 @@
extern Module *sysPrxForUser;
static const u32 PPU_THREAD_ID_INVALID = 0xFFFFFFFFU;
static const u32 PPU_THREAD_ID_INVALID = 0xFFFFFFFFU/*UUUUUUUUUUuuuuuuuuuu~~~~~~~~*/;
void sys_ppu_thread_exit(u64 errorcode)
void ppu_thread_exit(u64 errorcode)
{
sysPrxForUser->Log("sys_ppu_thread_exit(0x%llx)", errorcode);
PPUThread& thr = GetCurrentPPUThread();
u32 tid = thr.GetId();
@ -29,6 +27,20 @@ void sys_ppu_thread_exit(u64 errorcode)
thr.Stop();
}
void sys_ppu_thread_exit(u64 errorcode)
{
sysPrxForUser->Log("sys_ppu_thread_exit(0x%llx)", errorcode);
ppu_thread_exit(errorcode);
}
void sys_internal_ppu_thread_exit(u64 errorcode)
{
sysPrxForUser->Log("sys_internal_ppu_thread_exit(0x%llx)", errorcode);
ppu_thread_exit(errorcode);
}
s32 sys_ppu_thread_yield()
{
sysPrxForUser->Log("sys_ppu_thread_yield()");
@ -60,7 +72,7 @@ s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
s32 sys_ppu_thread_detach(u64 thread_id)
{
sysPrxForUser->Error("sys_ppu_thread_detach(thread_id=%lld)", thread_id);
sysPrxForUser->Todo("sys_ppu_thread_detach(thread_id=%lld)", thread_id);
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;

View File

@ -14,6 +14,7 @@ enum ppu_thread_flags : u64
// SysCalls
void sys_ppu_thread_exit(u64 errorcode);
void sys_internal_ppu_thread_exit(u64 errorcode);
s32 sys_ppu_thread_yield();
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr);
s32 sys_ppu_thread_detach(u64 thread_id);

View File

@ -17,7 +17,7 @@ s32 sys_process_getpid()
s32 sys_process_getppid()
{
sc_p.Warning("TODO: sys_process_getppid() returns 0");
sc_p.Todo("sys_process_getppid() -> 0");
return 0;
}
@ -46,7 +46,7 @@ void sys_game_process_exitspawn(
u32 prio,
u64 flags )
{
sc_p.Error("sys_game_process_exitspawn UNIMPLEMENTED");
sc_p.Todo("sys_game_process_exitspawn()");
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
sc_p.Warning("argv: 0x%x", argv_addr);
sc_p.Warning("envp: 0x%x", envp_addr);
@ -94,7 +94,7 @@ void sys_game_process_exitspawn2(
u32 prio,
u64 flags)
{
sc_p.Error("sys_game_process_exitspawn2 UNIMPLEMENTED");
sc_p.Todo("sys_game_process_exitspawn2");
sc_p.Warning("path: %s", Memory.ReadString(path_addr).c_str());
sc_p.Warning("argv: 0x%x", argv_addr);
sc_p.Warning("envp: 0x%x", envp_addr);
@ -170,7 +170,7 @@ s32 sys_process_get_number_of_object(u32 object, mem32_t nump)
s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size)
{
sc_p.Warning("TODO: sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
sc_p.Todo("sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
object, buffer.GetAddr(), size, set_size.GetAddr());
switch(object)
@ -213,7 +213,7 @@ s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_siz
s32 sys_process_get_paramsfo(mem8_ptr_t buffer)
{
sc_p.Warning("TODO: sys_process_get_paramsfo(buffer_addr=0x%x) returns CELL_ENOENT", buffer.GetAddr());
sc_p.Todo("sys_process_get_paramsfo(buffer_addr=0x%x) -> CELL_ENOENT", buffer.GetAddr());
return CELL_ENOENT;
/*//Before uncommenting this code, we should check if it is actually working.
@ -243,33 +243,33 @@ s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
s32 sys_process_kill(u32 pid)
{
sc_p.Error("TODO: sys_process_kill(pid=%d)", pid);
sc_p.Todo("sys_process_kill(pid=%d)", pid);
return CELL_OK;
}
s32 sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk)
{
sc_p.Error("TODO: sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
sc_p.Todo("sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
pid, status.GetAddr(), unk);
return CELL_OK;
}
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6)
{
sc_p.Error("TODO: sys_process_wait_for_child2(unk1=0x%llx, unk2=0x%llx, unk3=0x%llx, unk4=0x%llx, unk5=0x%llx, unk6=0x%llx)",
sc_p.Todo("sys_process_wait_for_child2(unk1=0x%llx, unk2=0x%llx, unk3=0x%llx, unk4=0x%llx, unk5=0x%llx, unk6=0x%llx)",
unk1, unk2, unk3, unk4, unk5, unk6);
return CELL_OK;
}
s32 sys_process_get_status(u64 unk)
{
sc_p.Error("TODO: sys_process_get_status(unk=0x%llx)", unk);
sc_p.Todo("sys_process_get_status(unk=0x%llx)", unk);
//Memory.Write32(CPU.GPR[4], GetPPUThreadStatus(CPU));
return CELL_OK;
}
s32 sys_process_detach_child(u64 unk)
{
sc_p.Error("TODO: sys_process_detach_child(unk=0x%llx)", unk);
sc_p.Todo("sys_process_detach_child(unk=0x%llx)", unk);
return CELL_OK;
}

View File

@ -14,7 +14,7 @@ s32 sys_prx_load_module(u32 path_addr, u64 flags, mem_ptr_t<sys_prx_load_module_
return CELL_PRX_ERROR_INVAL;
std::string path = Memory.ReadString(path_addr);
sys_prx.Error("TODO: sys_prx_load_module(path=\"%s\", flags=0x%llx, pOpt=0x%x)", path.c_str(), flags, pOpt.GetAddr());
sys_prx.Todo("sys_prx_load_module(path=\"%s\", flags=0x%llx, pOpt=0x%x)", path.c_str(), flags, pOpt.GetAddr());
vfsFile f(path);
if (!f.IsOpened()) {
@ -34,25 +34,25 @@ s32 sys_prx_load_module(u32 path_addr, u64 flags, mem_ptr_t<sys_prx_load_module_
s32 sys_prx_load_module_on_memcontainer()
{
sys_prx.Error("TODO: sys_prx_load_module_on_memcontainer()");
sys_prx.Todo("sys_prx_load_module_on_memcontainer()");
return CELL_OK;
}
s32 sys_prx_load_module_by_fd()
{
sys_prx.Error("TODO: sys_prx_load_module_by_fd()");
sys_prx.Todo("sys_prx_load_module_by_fd()");
return CELL_OK;
}
s32 sys_prx_load_module_on_memcontainer_by_fd()
{
sys_prx.Error("TODO: sys_prx_load_module_on_memcontainer_by_fd()");
sys_prx.Todo("sys_prx_load_module_on_memcontainer_by_fd()");
return CELL_OK;
}
s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 flags, mem_ptr_t<sys_prx_start_module_option_t> pOpt)
{
sys_prx.Error("TODO: sys_prx_start_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
sys_prx.Todo("sys_prx_start_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
id, args, argp_addr, modres.GetAddr(), flags, pOpt.GetAddr());
if (!modres.IsGood())
@ -70,7 +70,7 @@ s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 fl
s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 flags, mem_ptr_t<sys_prx_stop_module_option_t> pOpt)
{
sys_prx.Error("TODO: sys_prx_stop_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
sys_prx.Todo("sys_prx_stop_module(id=%d, args=%d, argp_addr=0x%x, modres_addr=0x%x, flags=0x%llx, pOpt=0x%x)",
id, args, argp_addr, modres.GetAddr(), flags, pOpt.GetAddr());
if (!modres.IsGood())
@ -88,7 +88,7 @@ s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 fla
s32 sys_prx_unload_module(s32 id, u64 flags, mem_ptr_t<sys_prx_unload_module_option_t> pOpt)
{
sys_prx.Error("TODO: sys_prx_unload_module(id=%d, flags=0x%llx, pOpt=0x%x)", id, flags, pOpt.GetAddr());
sys_prx.Todo("sys_prx_unload_module(id=%d, flags=0x%llx, pOpt=0x%x)", id, flags, pOpt.GetAddr());
// Get the PRX, free the used memory and delete the object and its ID
sys_prx_t* prx;
@ -102,90 +102,90 @@ s32 sys_prx_unload_module(s32 id, u64 flags, mem_ptr_t<sys_prx_unload_module_opt
s32 sys_prx_get_module_list()
{
sys_prx.Error("TODO: sys_prx_get_module_list()");
sys_prx.Todo("sys_prx_get_module_list()");
return CELL_OK;
}
s32 sys_prx_get_my_module_id()
{
sys_prx.Error("TODO: sys_prx_get_my_module_id()");
sys_prx.Todo("sys_prx_get_my_module_id()");
return CELL_OK;
}
s32 sys_prx_get_module_id_by_address()
{
sys_prx.Error("TODO: sys_prx_get_module_id_by_address()");
sys_prx.Todo("sys_prx_get_module_id_by_address()");
return CELL_OK;
}
s32 sys_prx_get_module_id_by_name()
{
sys_prx.Error("TODO: sys_prx_get_module_id_by_name()");
sys_prx.Todo("sys_prx_get_module_id_by_name()");
return CELL_OK;
}
s32 sys_prx_get_module_info()
{
sys_prx.Error("TODO: sys_prx_get_module_info()");
sys_prx.Todo("sys_prx_get_module_info()");
return CELL_OK;
}
s32 sys_prx_register_library(u32 lib_addr)
{
sys_prx.Error("TODO: sys_prx_register_library(lib_addr=0x%x)", lib_addr);
sys_prx.Todo("sys_prx_register_library(lib_addr=0x%x)", lib_addr);
return CELL_OK;
}
s32 sys_prx_unregister_library()
{
sys_prx.Error("TODO: sys_prx_unregister_library()");
sys_prx.Todo("sys_prx_unregister_library()");
return CELL_OK;
}
s32 sys_prx_get_ppu_guid()
{
sys_prx.Error("TODO: sys_prx_get_ppu_guid()");
sys_prx.Todo("sys_prx_get_ppu_guid()");
return CELL_OK;
}
s32 sys_prx_register_module()
{
sys_prx.Error("TODO: sys_prx_register_module()");
sys_prx.Todo("sys_prx_register_module()");
return CELL_OK;
}
s32 sys_prx_query_module()
{
sys_prx.Error("TODO: sys_prx_query_module()");
sys_prx.Todo("sys_prx_query_module()");
return CELL_OK;
}
s32 sys_prx_link_library()
{
sys_prx.Error("TODO: sys_prx_link_library()");
sys_prx.Todo("sys_prx_link_library()");
return CELL_OK;
}
s32 sys_prx_unlink_library()
{
sys_prx.Error("TODO: sys_prx_unlink_library()");
sys_prx.Todo("sys_prx_unlink_library()");
return CELL_OK;
}
s32 sys_prx_query_library()
{
sys_prx.Error("TODO: sys_prx_query_library()");
sys_prx.Todo("sys_prx_query_library()");
return CELL_OK;
}
s32 sys_prx_start()
{
sys_prx.Error("TODO: sys_prx_start()");
sys_prx.Todo("sys_prx_start()");
return CELL_OK;
}
s32 sys_prx_stop()
{
sys_prx.Error("TODO: sys_prx_stop()");
sys_prx.Todo("sys_prx_stop()");
return CELL_OK;
}

View File

@ -9,72 +9,72 @@ SysCallBase sys_rsx("sys_rsx");
s32 sys_rsx_device_open()
{
sys_rsx.Error("TODO: sys_rsx_device_open()");
sys_rsx.Todo("sys_rsx_device_open()");
return CELL_OK;
}
s32 sys_rsx_device_close()
{
sys_rsx.Error("TODO: sys_rsx_device_close()");
sys_rsx.Todo("sys_rsx_device_close()");
return CELL_OK;
}
s32 sys_rsx_memory_allocate()
{
sys_rsx.Error("TODO: sys_rsx_memory_allocate()");
sys_rsx.Todo("sys_rsx_memory_allocate()");
return CELL_OK;
}
s32 sys_rsx_memory_free()
{
sys_rsx.Error("TODO: sys_rsx_memory_free()");
sys_rsx.Todo("sys_rsx_memory_free()");
return CELL_OK;
}
s32 sys_rsx_context_allocate()
{
sys_rsx.Error("TODO: sys_rsx_context_allocate()");
sys_rsx.Todo("sys_rsx_context_allocate()");
return CELL_OK;
}
s32 sys_rsx_context_free()
{
sys_rsx.Error("TODO: sys_rsx_context_free()");
sys_rsx.Todo("sys_rsx_context_free()");
return CELL_OK;
}
s32 sys_rsx_context_iomap()
{
sys_rsx.Error("TODO: sys_rsx_context_iomap()");
sys_rsx.Todo("sys_rsx_context_iomap()");
return CELL_OK;
}
s32 sys_rsx_context_iounmap()
{
sys_rsx.Error("TODO: sys_rsx_context_iounmap()");
sys_rsx.Todo("sys_rsx_context_iounmap()");
return CELL_OK;
}
s32 sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6)
{
sys_rsx.Error("TODO: sys_rsx_context_attribute(context_id=%d, a2=%llu, a3=%llu, a4=%llu, a5=%llu, a6=%llu)", context_id, a2, a3, a4, a5, a6);
sys_rsx.Todo("sys_rsx_context_attribute(context_id=%d, a2=%llu, a3=%llu, a4=%llu, a5=%llu, a6=%llu)", context_id, a2, a3, a4, a5, a6);
return CELL_OK;
}
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3)
{
sys_rsx.Error("TODO: sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), a3);
sys_rsx.Todo("sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), a3);
return CELL_OK;
}
s32 sys_rsx_device_unmap()
{
sys_rsx.Error("TODO: sys_rsx_device_unmap()");
sys_rsx.Todo("sys_rsx_device_unmap()");
return CELL_OK;
}
s32 sys_rsx_attribute()
{
sys_rsx.Error("TODO: sys_rsx_attribute()");
sys_rsx.Todo("sys_rsx_attribute()");
return CELL_OK;
}

View File

@ -14,9 +14,9 @@ s32 sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr
switch (attr->attr_protocol.ToBE())
{
case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY attr"); break;
case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("Invalid SYS_SYNC_RETRY attr"); break;
case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break;
case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se(attr->attr_protocol, SYS_SYNC_FIFO): break;
default: return CELL_EINVAL;
}

View File

@ -35,8 +35,8 @@ s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, i
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_sem.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT protocol"); break;
case se32(SYS_SYNC_RETRY): sys_sem.Error("Invalid SYS_SYNC_RETRY protocol"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_sem.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_sem.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
default: sys_sem.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
}

View File

@ -4,53 +4,60 @@
#include "Emu/System.h"
#include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SysCalls.h"
#include "sys_spinlock.h"
SysCallBase sys_spinlock("sys_spinlock");
void sys_spinlock_initialize(mem_ptr_t<spinlock> lock)
void sys_spinlock_initialize(mem_ptr_t<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_initialize(lock_addr=0x%x)", lock.GetAddr());
lock->mutex.initialize();
// prx: set 0 and sync
*lock = be_t<u32>::MakeFromBE(0);
}
void sys_spinlock_lock(mem_ptr_t<spinlock> lock)
void sys_spinlock_lock(mem_ptr_t<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.GetAddr());
be_t<u32> tid = be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId());
switch (lock->mutex.lock(tid))
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
while (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE())
{
case SMR_ABORT: LOG_WARNING(HLE, "sys_spinlock_lock(0x%x) aborted", lock.GetAddr()); break;
case SMR_DEADLOCK: LOG_ERROR(HLE, "sys_spinlock_lock(0x%x) reached deadlock", lock.GetAddr()); break; // ???
default: break;
while (lock->load(std::memory_order_relaxed).ToBE())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
{
break;
}
}
if (Emu.IsStopped())
{
LOG_WARNING(HLE, "sys_spinlock_lock(0x%x) aborted", lock.GetAddr());
break;
}
}
}
s32 sys_spinlock_trylock(mem_ptr_t<spinlock> lock)
s32 sys_spinlock_trylock(mem_ptr_t<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.GetAddr());
be_t<u32> tid = be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId());
switch (lock->mutex.trylock(tid))
// prx: exchange with 0xabadcafe, translate exchanged value
if (lock->exchange(be_t<u32>::MakeFromBE(se32(0xabadcafe))).ToBE())
{
case SMR_FAILED: return CELL_EBUSY;
case SMR_ABORT: LOG_WARNING(HLE, "sys_spinlock_trylock(0x%x) aborted", lock.GetAddr()); break;
case SMR_DEADLOCK: LOG_ERROR(HLE, "sys_spinlock_trylock(0x%x) reached deadlock", lock.GetAddr()); break;
default: break;
return CELL_EBUSY;
}
return CELL_OK;
}
void sys_spinlock_unlock(mem_ptr_t<spinlock> lock)
void sys_spinlock_unlock(mem_ptr_t<std::atomic<be_t<u32>>> lock)
{
sys_spinlock.Log("sys_spinlock_unlock(lock_addr=0x%x)", lock.GetAddr());
while(true)
{
if (lock->mutex.unlock(lock->mutex.GetOwner()) != SMR_PERMITTED)
break;
}
// prx: sync and set 0
*lock = be_t<u32>::MakeFromBE(0);
}

View File

@ -1,12 +1,7 @@
#pragma once
struct spinlock
{
SMutexBE mutex;
};
// SysCalls
void sys_spinlock_initialize(mem_ptr_t<spinlock> lock);
void sys_spinlock_lock(mem_ptr_t<spinlock> lock);
s32 sys_spinlock_trylock(mem_ptr_t<spinlock> lock);
void sys_spinlock_unlock(mem_ptr_t<spinlock> lock);
void sys_spinlock_initialize(mem_ptr_t<std::atomic<be_t<u32>>> lock);
void sys_spinlock_lock(mem_ptr_t<std::atomic<be_t<u32>>> lock);
s32 sys_spinlock_trylock(mem_ptr_t<std::atomic<be_t<u32>>> lock);
void sys_spinlock_unlock(mem_ptr_t<std::atomic<be_t<u32>>> lock);

View File

@ -356,7 +356,7 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
s32 sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
{
sc_spu.Error("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
sc_spu.Todo("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
thread_id.GetAddr(), entry.GetAddr(), arg, prio, stacksize, flags, threadname_addr);
return CELL_OK;
}
@ -524,14 +524,14 @@ s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
{
sc_spu.Error("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
sc_spu.Todo("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
return CELL_OK;
}
s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et)
{
sc_spu.Error("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
sc_spu.Todo("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
return CELL_OK;
}
@ -762,7 +762,7 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
s32 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);
sc_spu.Todo("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
return CELL_OK;
}

View File

@ -20,7 +20,7 @@ s32 sys_timer_create(mem32_t timer_id)
s32 sys_timer_destroy(u32 timer_id)
{
sys_timer.Warning("TODO: sys_timer_destroy(timer_id=%d)", timer_id);
sys_timer.Todo("sys_timer_destroy(timer_id=%d)", timer_id);
if(!sys_timer.CheckId(timer_id)) return CELL_ESRCH;
@ -65,7 +65,7 @@ s32 sys_timer_start(u32 timer_id, s64 base_time, u64 period)
s32 sys_timer_stop(u32 timer_id)
{
sys_timer.Warning("TODO: sys_timer_stop()");
sys_timer.Todo("sys_timer_stop()");
timer* timer_data = nullptr;
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH;
@ -91,7 +91,7 @@ s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
s32 sys_timer_disconnect_event_queue(u32 timer_id)
{
sys_timer.Warning("TODO: sys_timer_disconnect_event_queue(timer_id=%d)", timer_id);
sys_timer.Todo("sys_timer_disconnect_event_queue(timer_id=%d)", timer_id);
timer* timer_data = nullptr;
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH;

View File

@ -390,12 +390,11 @@ void MainFrame::Config(wxCommandEvent& WXUNUSED(event))
wxCheckBox* chbox_hle_exitonstop = new wxCheckBox(p_hle, wxID_ANY, "Exit RPCS3 when process finishes");
wxCheckBox* chbox_hle_always_start = new wxCheckBox(p_hle, wxID_ANY, "Always start after boot");
//cbox_cpu_decoder->Append("DisAsm");
cbox_cpu_decoder->Append("Interpreter & DisAsm");
cbox_cpu_decoder->Append("Interpreter");
cbox_cpu_decoder->Append("PPU Interpreter & DisAsm");
cbox_cpu_decoder->Append("PPU Interpreter");
cbox_spu_decoder->Append("Interpreter");
cbox_spu_decoder->Append("Recompiler");
cbox_spu_decoder->Append("SPU Interpreter");
cbox_spu_decoder->Append("SPU JIT (asmjit)");
for(int i=1; i<WXSIZEOF(ResolutionTable); ++i)
{

View File

@ -315,6 +315,7 @@
<ClInclude Include="Emu\Memory\MemoryBlock.h" />
<ClInclude Include="Emu\SysCalls\Callback.h" />
<ClInclude Include="Emu\SysCalls\ErrorCodes.h" />
<ClInclude Include="Emu\SysCalls\LogBase.h" />
<ClInclude Include="Emu\SysCalls\lv2\lv2Fs.h" />
<ClInclude Include="Emu\SysCalls\lv2\sys_cond.h" />
<ClInclude Include="Emu\SysCalls\lv2\sys_event.h" />
@ -352,6 +353,7 @@
<ClInclude Include="Emu\SysCalls\Modules\cellResc.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellRtc.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSpurs.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSync.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSysutil.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellSysutil_SaveData.h" />
<ClInclude Include="Emu\SysCalls\Modules\cellUserInfo.h" />
@ -560,4 +562,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -1090,5 +1090,11 @@
<ClInclude Include="Emu\Memory\DynamicMemoryBlockBase.h">
<Filter>Emu\Memory</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\Modules\cellSync.h">
<Filter>Emu\SysCalls\Modules</Filter>
</ClInclude>
<ClInclude Include="Emu\SysCalls\LogBase.h">
<Filter>Emu\SysCalls</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>