mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
commit
3d47c8ab9f
@ -318,6 +318,11 @@ bool rDir::Open(const std::string& path)
|
||||
return reinterpret_cast<wxDir*>(handle)->Open(fmt::FromUTF8(path));
|
||||
}
|
||||
|
||||
bool rDir::IsOpened() const
|
||||
{
|
||||
return reinterpret_cast<wxDir*>(handle)->IsOpened();
|
||||
}
|
||||
|
||||
bool rDir::GetFirst(std::string *filename) const
|
||||
{
|
||||
wxString str;
|
||||
|
@ -66,6 +66,7 @@ struct rDir
|
||||
rDir(const rDir& other) = delete;
|
||||
rDir(const std::string &path);
|
||||
bool Open(const std::string& path);
|
||||
bool IsOpened() const;
|
||||
static bool Exists(const std::string &path);
|
||||
bool GetFirst(std::string *filename) const;
|
||||
bool GetNext(std::string *filename) const;
|
||||
|
@ -148,12 +148,6 @@ void CPUThread::NextPc(u8 instr_size)
|
||||
|
||||
void CPUThread::SetBranch(const u64 pc, bool record_branch)
|
||||
{
|
||||
if(!Memory.IsGoodAddr(m_offset + pc))
|
||||
{
|
||||
LOG_ERROR(PPU, "%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().c_str(), m_offset + pc, m_offset + PC);
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
m_is_branch = true;
|
||||
nPC = pc;
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "SPUThread.h"
|
||||
#include "Emu/Event.h"
|
||||
|
||||
__forceinline static u32 GetRawSPURegAddrByNum(int num, int offset)
|
||||
{
|
||||
|
@ -337,12 +337,6 @@ private:
|
||||
void STQX(u32 rt, u32 ra, u32 rb)
|
||||
{
|
||||
u32 lsa = (CPU.GPR[ra]._u32[3] + CPU.GPR[rb]._u32[3]) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "STQX: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.WriteLS128(lsa, CPU.GPR[rt]._u128);
|
||||
}
|
||||
@ -436,13 +430,6 @@ private:
|
||||
|
||||
u32 lsa = (a + b) & 0x3fff0;
|
||||
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "LQX: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.GPR[rt]._u128 = CPU.ReadLS128(lsa);
|
||||
}
|
||||
void ROTQBYBI(u32 rt, u32 ra, u32 rb)
|
||||
@ -1169,12 +1156,6 @@ private:
|
||||
void STQA(u32 rt, s32 i16)
|
||||
{
|
||||
u32 lsa = (i16 << 2) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "STQA: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.WriteLS128(lsa, CPU.GPR[rt]._u128);
|
||||
}
|
||||
@ -1220,12 +1201,6 @@ private:
|
||||
void STQR(u32 rt, s32 i16)
|
||||
{
|
||||
u32 lsa = branchTarget(CPU.PC, i16) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "STQR: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.WriteLS128(lsa, CPU.GPR[rt]._u128);
|
||||
}
|
||||
@ -1238,12 +1213,6 @@ private:
|
||||
void LQA(u32 rt, s32 i16)
|
||||
{
|
||||
u32 lsa = (i16 << 2) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "LQA: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.GPR[rt]._u128 = CPU.ReadLS128(lsa);
|
||||
}
|
||||
@ -1288,12 +1257,6 @@ private:
|
||||
void LQR(u32 rt, s32 i16)
|
||||
{
|
||||
u32 lsa = branchTarget(CPU.PC, i16) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "LQR: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.GPR[rt]._u128 = CPU.ReadLS128(lsa);
|
||||
}
|
||||
@ -1377,24 +1340,13 @@ private:
|
||||
void STQD(u32 rt, s32 i10, u32 ra) //i10 is shifted left by 4 while decoding
|
||||
{
|
||||
const u32 lsa = (CPU.GPR[ra]._i32[3] + i10) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "STQD: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
//LOG_NOTICE(Log::SPU, "STQD(lsa=0x%x): GPR[%d] (0x%llx%llx)", lsa, rt, CPU.GPR[rt]._u64[1], CPU.GPR[rt]._u64[0]);
|
||||
CPU.WriteLS128(lsa, CPU.GPR[rt]._u128);
|
||||
}
|
||||
void LQD(u32 rt, s32 i10, u32 ra) //i10 is shifted left by 4 while decoding
|
||||
{
|
||||
const u32 lsa = (CPU.GPR[ra]._i32[3] + i10) & 0x3fff0;
|
||||
if(!CPU.IsGoodLSA(lsa))
|
||||
{
|
||||
LOG_ERROR(Log::SPU, "LQD: bad lsa (0x%x)", lsa);
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
|
||||
CPU.GPR[rt]._u128 = CPU.ReadLS128(lsa);
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
#include "SPUInstrTable.h"
|
||||
#include "SPUDisAsm.h"
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
#include "Emu/Cell/SPUThread.h"
|
||||
#include "Emu/Cell/SPUDecoder.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "PPCThread.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "Emu/SysCalls/lv2/sys_spu.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
#include "MFC.h"
|
||||
#include "Emu/SysCalls/ErrorCodes.h"
|
||||
@ -901,6 +901,7 @@ public:
|
||||
switch(ch)
|
||||
{
|
||||
case SPU_WrOutMbox: return SPU.Out_MBox.GetFreeCount();
|
||||
case SPU_WrOutIntrMbox: return SPU.Out_IntrMBox.GetFreeCount();
|
||||
case SPU_RdInMbox: return SPU.In_MBox.GetCount();
|
||||
case MFC_RdTagStat: return MFC1.TagStatus.GetCount();
|
||||
case MFC_RdListStallStat: return StallStat.GetCount();
|
||||
@ -929,16 +930,24 @@ public:
|
||||
if (!group) // if RawSPU
|
||||
{
|
||||
if (Ini.HLELogging.GetValue()) LOG_NOTICE(Log::SPU, "SPU_WrOutIntrMbox: interrupt(v=0x%x)", v);
|
||||
SPU.Out_IntrMBox.PushUncond(v);
|
||||
while (!SPU.Out_IntrMBox.Push(v))
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(Log::SPU, "%s(%s) aborted (I)", __FUNCTION__, spu_ch_name[ch]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_intrtag[2].stat |= 1;
|
||||
if (CPUThread* t = Emu.GetCPU().GetThread(m_intrtag[2].thread))
|
||||
{
|
||||
while (t->IsAlive())
|
||||
while (t->IsAlive()) // TODO: ???
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]);
|
||||
LOG_WARNING(Log::SPU, "%s(%s) aborted (II)", __FUNCTION__, spu_ch_name[ch]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1065,21 +1074,18 @@ public:
|
||||
|
||||
case SPU_WrOutMbox:
|
||||
{
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
while (!SPU.Out_MBox.Push(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
break;
|
||||
}
|
||||
|
||||
case MFC_WrTagMask:
|
||||
{
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
MFC1.QueryMask.SetValue(v);
|
||||
break;
|
||||
}
|
||||
|
||||
case MFC_WrTagUpdate:
|
||||
{
|
||||
//ConLog.Warning("%s: %s = 0x%x", __FUNCTION__, spu_ch_name[ch], v);
|
||||
MFC1.TagStatus.PushUncond(MFC1.QueryMask.GetValue());
|
||||
break;
|
||||
}
|
||||
@ -1167,28 +1173,24 @@ public:
|
||||
case SPU_RdInMbox:
|
||||
{
|
||||
while (!SPU.In_MBox.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
case MFC_RdTagStat:
|
||||
{
|
||||
while (!MFC1.TagStatus.Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
case SPU_RdSigNotify1:
|
||||
{
|
||||
while (!SPU.SNR[0].Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
case SPU_RdSigNotify2:
|
||||
{
|
||||
while (!SPU.SNR[1].Pop(v) && !Emu.IsStopped()) std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
//ConLog.Warning("%s: 0x%x = %s", __FUNCTION__, v, spu_ch_name[ch]);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1331,8 +1333,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool IsGoodLSA(const u32 lsa) const { return Memory.IsGoodAddr(lsa + m_offset) && lsa < 0x40000; }
|
||||
virtual u8 ReadLS8 (const u32 lsa) const { return Memory.Read8 (lsa + m_offset); } // m_offset & 0x3fffc ?????
|
||||
virtual u8 ReadLS8 (const u32 lsa) const { return Memory.Read8 (lsa + m_offset); }
|
||||
virtual u16 ReadLS16 (const u32 lsa) const { return Memory.Read16 (lsa + m_offset); }
|
||||
virtual u32 ReadLS32 (const u32 lsa) const { return Memory.Read32 (lsa + m_offset); }
|
||||
virtual u64 ReadLS64 (const u32 lsa) const { return Memory.Read64 (lsa + m_offset); }
|
||||
|
@ -1,229 +1,17 @@
|
||||
#pragma once
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
|
||||
#define FIX_SPUQ(x) ((u64)x | 0x5350555100000000ULL)
|
||||
// arbitrary code to prevent "special" zero value in key argument
|
||||
|
||||
enum EventQueueType
|
||||
{
|
||||
SYS_PPU_QUEUE = 1,
|
||||
SYS_SPU_QUEUE = 2,
|
||||
};
|
||||
|
||||
enum EventQueueDestroyMode
|
||||
{
|
||||
// DEFAULT = 0,
|
||||
SYS_EVENT_QUEUE_DESTROY_FORCE = 1,
|
||||
};
|
||||
|
||||
enum EventPortType
|
||||
{
|
||||
SYS_EVENT_PORT_LOCAL = 1,
|
||||
};
|
||||
|
||||
enum EventSourceType
|
||||
{
|
||||
SYS_SPU_THREAD_EVENT_USER = 1,
|
||||
/* SYS_SPU_THREAD_EVENT_DMA = 2, */ // not supported
|
||||
};
|
||||
|
||||
enum EventSourceKey : u64
|
||||
{
|
||||
SYS_SPU_THREAD_EVENT_USER_KEY = 0xFFFFFFFF53505501,
|
||||
/* SYS_SPU_THREAD_EVENT_DMA_KEY = 0xFFFFFFFF53505502, */
|
||||
};
|
||||
|
||||
struct sys_event_queue_attr
|
||||
{
|
||||
be_t<u32> protocol; // SYS_SYNC_PRIORITY or SYS_SYNC_FIFO
|
||||
be_t<int> type; // SYS_PPU_QUEUE or SYS_SPU_QUEUE
|
||||
union
|
||||
{
|
||||
char name[8];
|
||||
u64 name_u64;
|
||||
};
|
||||
};
|
||||
|
||||
struct sys_event_data
|
||||
{
|
||||
be_t<u64> source;
|
||||
be_t<u64> data1;
|
||||
be_t<u64> data2;
|
||||
be_t<u64> data3;
|
||||
};
|
||||
|
||||
struct EventQueue;
|
||||
|
||||
struct EventPort
|
||||
{
|
||||
u64 name; // generated or user-specified code that is passed to sys_event_data struct
|
||||
EventQueue* eq; // event queue this port has been connected to
|
||||
std::mutex m_mutex; // may be locked until the event sending is finished
|
||||
|
||||
EventPort(u64 name = 0)
|
||||
: eq(nullptr)
|
||||
, name(name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EventRingBuffer
|
||||
{
|
||||
std::vector<sys_event_data> data;
|
||||
std::mutex m_mutex;
|
||||
u32 buf_pos;
|
||||
u32 buf_count;
|
||||
|
||||
public:
|
||||
const u32 size;
|
||||
|
||||
EventRingBuffer(u32 size)
|
||||
: size(size)
|
||||
, buf_pos(0)
|
||||
, buf_count(0)
|
||||
{
|
||||
data.resize(size);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
buf_count = 0;
|
||||
buf_pos = 0;
|
||||
}
|
||||
|
||||
bool push(u64 name, u64 d1, u64 d2, u64 d3)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (buf_count >= size) return false;
|
||||
|
||||
sys_event_data& ref = data[(buf_pos + buf_count++) % size];
|
||||
ref.source = name;
|
||||
ref.data1 = d1;
|
||||
ref.data2 = d2;
|
||||
ref.data3 = d3;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pop(sys_event_data& ref)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (!buf_count) return false;
|
||||
|
||||
sys_event_data& from = data[buf_pos];
|
||||
buf_pos = (buf_pos + 1) % size;
|
||||
buf_count--;
|
||||
ref.source = from.source;
|
||||
ref.data1 = from.data1;
|
||||
ref.data2 = from.data2;
|
||||
ref.data3 = from.data3;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 pop_all(sys_event_data* ptr, u32 max)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
u32 res = 0;
|
||||
while (buf_count && max)
|
||||
{
|
||||
sys_event_data& from = data[buf_pos];
|
||||
ptr->source = from.source;
|
||||
ptr->data1 = from.data1;
|
||||
ptr->data2 = from.data2;
|
||||
ptr->data3 = from.data3;
|
||||
buf_pos = (buf_pos + 1) % size;
|
||||
buf_count--;
|
||||
max--;
|
||||
ptr++;
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 count() const
|
||||
{
|
||||
return buf_count;
|
||||
}
|
||||
};
|
||||
|
||||
class EventPortList
|
||||
{
|
||||
std::vector<EventPort*> data;
|
||||
std::mutex m_mutex;
|
||||
|
||||
public:
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock2(data[i]->m_mutex);
|
||||
data[i]->eq = nullptr; // force all ports to disconnect
|
||||
}
|
||||
data.clear();
|
||||
}
|
||||
|
||||
void add(EventPort* port)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
data.push_back(port);
|
||||
}
|
||||
|
||||
void remove(EventPort* port)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
if (data[i] == port)
|
||||
{
|
||||
data.erase(data.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct EventQueue
|
||||
{
|
||||
SleepQueue sq;
|
||||
EventPortList ports;
|
||||
EventRingBuffer events;
|
||||
SMutex owner;
|
||||
|
||||
const union
|
||||
{
|
||||
u64 name_u64;
|
||||
char name[8];
|
||||
};
|
||||
const u32 protocol;
|
||||
const int type;
|
||||
const u64 key;
|
||||
|
||||
EventQueue(u32 protocol, int type, u64 name, u64 key, int size)
|
||||
: type(type)
|
||||
, protocol(protocol)
|
||||
, name_u64(name)
|
||||
, key(key)
|
||||
, events(size) // size: max event count this queue can hold
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class EventManager
|
||||
{
|
||||
std::mutex m_lock;
|
||||
std::unordered_map<u64, EventQueue*> key_map;
|
||||
|
||||
public:
|
||||
void Init();
|
||||
void Clear();
|
||||
bool CheckKey(u64 key);
|
||||
bool RegisterKey(EventQueue* data, u64 key);
|
||||
bool GetEventQueue(u64 key, EventQueue*& data);
|
||||
bool UnregisterKey(u64 key);
|
||||
bool SendEvent(u64 key, u64 source, u64 d1, u64 d2, u64 d3);
|
||||
};
|
||||
#pragma once
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
class EventManager
|
||||
{
|
||||
std::mutex m_lock;
|
||||
std::unordered_map<u64, EventQueue*> key_map;
|
||||
|
||||
public:
|
||||
void Init();
|
||||
void Clear();
|
||||
bool CheckKey(u64 key);
|
||||
bool RegisterKey(EventQueue* data, u64 key);
|
||||
bool GetEventQueue(u64 key, EventQueue*& data);
|
||||
bool UnregisterKey(u64 key);
|
||||
bool SendEvent(u64 key, u64 source, u64 d1, u64 d2, u64 d3);
|
||||
};
|
||||
|
@ -15,8 +15,6 @@ bool vfsLocalDir::Open(const std::string& path)
|
||||
if(!vfsDirBase::Open(path))
|
||||
return false;
|
||||
|
||||
rDir dir;
|
||||
|
||||
if(!dir.Open(path))
|
||||
return false;
|
||||
|
||||
@ -57,3 +55,8 @@ bool vfsLocalDir::Remove(const std::string& path)
|
||||
{
|
||||
return rRmdir(path);
|
||||
}
|
||||
|
||||
bool vfsLocalDir::IsOpened() const
|
||||
{
|
||||
return dir.IsOpened() && vfsDirBase::IsOpened();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ class vfsLocalDir : public vfsDirBase
|
||||
{
|
||||
private:
|
||||
u32 m_pos;
|
||||
rDir dir;
|
||||
|
||||
public:
|
||||
vfsLocalDir(vfsDevice* device);
|
||||
@ -15,4 +16,5 @@ public:
|
||||
virtual bool Create(const std::string& path) override;
|
||||
virtual bool Rename(const std::string& from, const std::string& to) override;
|
||||
virtual bool Remove(const std::string& path) override;
|
||||
virtual bool IsOpened() const override;
|
||||
};
|
@ -32,14 +32,9 @@ u64 vfsStreamMemory::Write(const void* src, u64 size)
|
||||
size = GetSize() - Tell();
|
||||
}
|
||||
|
||||
if (!Memory.CopyFromReal(m_addr + Tell(), (void*)src, size))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return vfsStream::Write(src, size);
|
||||
}
|
||||
memcpy(Memory + m_addr + Tell(), (void*)src, size);
|
||||
|
||||
return vfsStream::Write(src, size);
|
||||
}
|
||||
|
||||
u64 vfsStreamMemory::Read(void* dst, u64 size)
|
||||
@ -49,12 +44,7 @@ u64 vfsStreamMemory::Read(void* dst, u64 size)
|
||||
size = GetSize() - Tell();
|
||||
}
|
||||
|
||||
if (!Memory.CopyToReal(dst, m_addr + Tell(), size))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return vfsStream::Read(dst, size);
|
||||
}
|
||||
memcpy(dst, Memory + m_addr + Tell(), size);
|
||||
|
||||
return vfsStream::Read(dst, size);
|
||||
}
|
||||
|
@ -106,36 +106,6 @@ u64 MemoryBlock::FixAddr(const u64 addr) const
|
||||
return addr - GetStartAddr();
|
||||
}
|
||||
|
||||
bool MemoryBlock::GetMemFromAddr(void* dst, const u64 addr, const u32 size)
|
||||
{
|
||||
if(!IsMyAddress(addr) || FixAddr(addr) + size > GetSize()) return false;
|
||||
|
||||
return Memory.CopyToReal(dst, addr, size);
|
||||
}
|
||||
|
||||
bool MemoryBlock::SetMemFromAddr(void* src, const u64 addr, const u32 size)
|
||||
{
|
||||
if(!IsMyAddress(addr) || FixAddr(addr) + size > GetSize()) return false;
|
||||
|
||||
return Memory.CopyFromReal(addr, src, size);
|
||||
}
|
||||
|
||||
bool MemoryBlock::GetMemFFromAddr(void* dst, const u64 addr)
|
||||
{
|
||||
if(!IsMyAddress(addr)) return false;
|
||||
|
||||
dst = GetMem(FixAddr(addr));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u8* MemoryBlock::GetMemFromAddr(const u64 addr)
|
||||
{
|
||||
if(!IsMyAddress(addr) || IsNULL()) return nullptr;
|
||||
|
||||
return GetMem(FixAddr(addr));
|
||||
}
|
||||
|
||||
MemoryBlock* MemoryBlock::SetRange(const u64 start, const u32 size)
|
||||
{
|
||||
if (start + size > 0x100000000) return nullptr;
|
||||
|
@ -391,20 +391,32 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
noinline void WriteMMIO32(u32 addr, const u32 data)
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
|
||||
if (RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET] &&
|
||||
RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Write32(addr, data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
*(u32*)((u8*)GetBaseAddr() + addr) = re32(data); // provoke error
|
||||
}
|
||||
|
||||
template<typename T> void Write32(T addr, const u32 data)
|
||||
{
|
||||
if ((u32)addr == addr)
|
||||
{
|
||||
if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET || !RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET])
|
||||
if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET)
|
||||
{
|
||||
*(u32*)((u8*)GetBaseAddr() + addr) = re32(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Write32(addr, data))
|
||||
{
|
||||
*(u32*)((u8*)GetBaseAddr() + addr) = re32(data);
|
||||
}
|
||||
WriteMMIO32(addr, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -466,22 +478,34 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
noinline u32 ReadMMIO32(u32 addr)
|
||||
{
|
||||
u32 res;
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_mutex);
|
||||
|
||||
if (RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET] &&
|
||||
RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Read32(addr, &res))
|
||||
{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
res = re32(*(u32*)((u8*)GetBaseAddr() + addr)); // provoke error
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename T> u32 Read32(T addr)
|
||||
{
|
||||
if ((u32)addr == addr)
|
||||
{
|
||||
if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET || !RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET])
|
||||
if (addr < RAW_SPU_BASE_ADDR || (addr % RAW_SPU_OFFSET) < RAW_SPU_PROB_OFFSET)
|
||||
{
|
||||
return re32(*(u32*)((u8*)GetBaseAddr() + addr));
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 res;
|
||||
if (!RawSPUMem[(addr - RAW_SPU_BASE_ADDR) / RAW_SPU_OFFSET]->Read32(addr, &res))
|
||||
{
|
||||
res = re32(*(u32*)((u8*)GetBaseAddr() + addr));
|
||||
}
|
||||
return res;
|
||||
return ReadMMIO32(addr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -517,33 +541,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> bool CopyToReal(void* real, T from, u32 count)
|
||||
{
|
||||
if (!IsGoodAddr<T>(from, count)) return false;
|
||||
|
||||
memcpy(real, GetMemFromAddr<T>(from), count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T> bool CopyFromReal(T to, const void* real, u32 count)
|
||||
{
|
||||
if (!IsGoodAddr<T>(to, count)) return false;
|
||||
|
||||
memcpy(GetMemFromAddr<T>(to), real, count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2> bool Copy(T1 to, T2 from, u32 count)
|
||||
{
|
||||
if (!IsGoodAddr<T1>(to, count) || !IsGoodAddr<T2>(from, count)) return false;
|
||||
|
||||
memmove(GetMemFromAddr<T1>(to), GetMemFromAddr<T2>(from), count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReadLeft(u8* dst, const u64 addr, const u32 size)
|
||||
{
|
||||
for (u32 i = 0; i < size; ++i) dst[size - 1 - i] = Read8(addr + i);
|
||||
@ -574,21 +571,21 @@ public:
|
||||
*(Td*)GetMemFromAddr<T>(addr) = data;
|
||||
}
|
||||
|
||||
std::string ReadString(const u64 addr, const u64 len)
|
||||
template<typename T> std::string ReadString(const T addr, const u64 len)
|
||||
{
|
||||
std::string ret((const char *)GetMemFromAddr(addr), len);
|
||||
std::string ret((const char *)GetMemFromAddr<T>(addr), len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string ReadString(const u64 addr)
|
||||
template<typename T> std::string ReadString(const T addr)
|
||||
{
|
||||
return std::string((const char*)GetMemFromAddr(addr));
|
||||
return std::string((const char*)GetMemFromAddr<T>(addr));
|
||||
}
|
||||
|
||||
void WriteString(const u64 addr, const std::string& str)
|
||||
template<typename T> void WriteString(const T addr, const std::string& str)
|
||||
{
|
||||
strcpy((char*)GetMemFromAddr(addr), str.c_str());
|
||||
strcpy((char*)GetMemFromAddr<T>(addr), str.c_str());
|
||||
}
|
||||
|
||||
static u64 AlignAddr(const u64 addr, const u64 align)
|
||||
|
@ -283,11 +283,6 @@ public:
|
||||
|
||||
u64 FixAddr(const u64 addr) const;
|
||||
|
||||
bool GetMemFromAddr(void* dst, const u64 addr, const u32 size);
|
||||
bool SetMemFromAddr(void* src, const u64 addr, const u32 size);
|
||||
bool GetMemFFromAddr(void* dst, const u64 addr);
|
||||
u8* GetMemFromAddr(const u64 addr);
|
||||
|
||||
virtual MemoryBlock* SetRange(const u64 start, const u32 size);
|
||||
virtual bool IsMyAddress(const u64 addr);
|
||||
virtual bool IsLocked(const u64 addr) { return false; }
|
||||
|
@ -21,7 +21,7 @@ enum CELL_KB_ERROR_CODE
|
||||
|
||||
int cellKbInit(u32 max_connect)
|
||||
{
|
||||
sys_io->Log("cellKbInit(max_connect=%d)", max_connect);
|
||||
sys_io->Warning("cellKbInit(max_connect=%d)", max_connect);
|
||||
if(Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_ALREADY_INITIALIZED;
|
||||
if(max_connect > 7) return CELL_KB_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
@ -21,7 +21,7 @@ enum CELL_MOUSE_ERROR_CODE
|
||||
|
||||
int cellMouseInit(u32 max_connect)
|
||||
{
|
||||
sys_io->Log("cellMouseInit(max_connect=%d)", max_connect);
|
||||
sys_io->Warning("cellMouseInit(max_connect=%d)", max_connect);
|
||||
if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
|
||||
if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
||||
|
||||
|
@ -55,7 +55,7 @@ struct CellCapabilityInfo
|
||||
|
||||
int cellPadInit(u32 max_connect)
|
||||
{
|
||||
sys_io->Log("cellPadInit(max_connect=%d)", max_connect);
|
||||
sys_io->Warning("cellPadInit(max_connect=%d)", max_connect);
|
||||
if(Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_ALREADY_INITIALIZED;
|
||||
if (max_connect > CELL_PAD_MAX_PORT_NUM) return CELL_PAD_ERROR_INVALID_PARAMETER;
|
||||
Emu.GetPadManager().Init(max_connect);
|
||||
|
@ -50,12 +50,7 @@ next:
|
||||
break;
|
||||
case adecDecodeAu:
|
||||
{
|
||||
if (!Memory.CopyToReal(buf, adec.reader.addr, adec.reader.size))
|
||||
{
|
||||
LOG_ERROR(HLE, "adecRawRead(): data reading failed (reader.size=0x%x)", adec.reader.size);
|
||||
Emu.Pause();
|
||||
return 0;
|
||||
}
|
||||
memcpy(buf, Memory + adec.reader.addr, adec.reader.size);
|
||||
|
||||
buf += adec.reader.size;
|
||||
buf_size -= adec.reader.size;
|
||||
@ -86,14 +81,10 @@ next:
|
||||
{
|
||||
return res;
|
||||
}
|
||||
else if (!Memory.CopyToReal(buf, adec.reader.addr, buf_size))
|
||||
{
|
||||
LOG_ERROR(HLE, "adecRawRead(): data reading failed (buf_size=0x%x)", buf_size);
|
||||
Emu.Pause();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(buf, Memory + adec.reader.addr, buf_size);
|
||||
|
||||
adec.reader.addr += buf_size;
|
||||
adec.reader.size -= buf_size;
|
||||
return res + buf_size;
|
||||
@ -547,11 +538,6 @@ int cellAdecQueryAttr(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecAttr> attr
|
||||
{
|
||||
cellAdec->Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_ADEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
|
||||
|
||||
// TODO: check values
|
||||
@ -567,11 +553,6 @@ int cellAdecOpen(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResource> res,
|
||||
cellAdec->Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
|
||||
type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
|
||||
{
|
||||
return CELL_ADEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
|
||||
|
||||
handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
@ -584,11 +565,6 @@ int cellAdecOpenEx(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResourceEx> r
|
||||
cellAdec->Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
|
||||
type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
|
||||
{
|
||||
return CELL_ADEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG;
|
||||
|
||||
handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
|
||||
@ -671,11 +647,6 @@ int cellAdecDecodeAu(u32 handle, mem_ptr_t<CellAdecAuInfo> auInfo)
|
||||
return CELL_ADEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!auInfo.IsGood())
|
||||
{
|
||||
return CELL_ADEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
AdecTask task(adecDecodeAu);
|
||||
task.au.auInfo_addr = auInfo.GetAddr();
|
||||
task.au.addr = auInfo->startAddr;
|
||||
@ -706,52 +677,28 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr)
|
||||
adec->frames.Pop(af);
|
||||
AVFrame* frame = af.data;
|
||||
|
||||
int result = CELL_OK;
|
||||
|
||||
if (!Memory.IsGoodAddr(outBuffer_addr, af.size))
|
||||
{
|
||||
result = CELL_ADEC_ERROR_FATAL;
|
||||
if (af.data)
|
||||
{
|
||||
av_frame_unref(af.data);
|
||||
av_frame_free(&af.data);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
if (!af.data) // fake: empty data
|
||||
{
|
||||
return result;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
// copy data
|
||||
u8* out = (u8*)calloc(1, af.size);
|
||||
|
||||
// reverse byte order, extract data:
|
||||
float* in_f[2];
|
||||
in_f[0] = (float*)frame->extended_data[0];
|
||||
in_f[1] = (float*)frame->extended_data[1];
|
||||
be_t<float>* out_f = (be_t<float>*)out;
|
||||
be_t<float>* out_f = (be_t<float>*)Memory.GetMemFromAddr(outBuffer_addr);
|
||||
for (u32 i = 0; i < af.size / 8; i++)
|
||||
{
|
||||
out_f[i*2] = in_f[0][i];
|
||||
out_f[i*2+1] = in_f[1][i];
|
||||
}
|
||||
|
||||
if (!Memory.CopyFromReal(outBuffer_addr, out, af.size))
|
||||
{
|
||||
LOG_ERROR(HLE, "cellAdecGetPcm(%d): data copying failed (addr=0x%x)", handle, outBuffer_addr);
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
free(out);
|
||||
|
||||
if (af.data)
|
||||
{
|
||||
av_frame_unref(af.data);
|
||||
av_frame_free(&af.data);
|
||||
}
|
||||
return result;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr)
|
||||
@ -764,11 +711,6 @@ int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr)
|
||||
return CELL_ADEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!pcmItem_ptr.IsGood())
|
||||
{
|
||||
return CELL_ADEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (adec->frames.IsEmpty())
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Utilities/SQueue.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "Emu/Audio/cellAudio.h"
|
||||
#include "Emu/Audio/AudioManager.h"
|
||||
#include "Emu/Audio/AudioDumper.h"
|
||||
@ -509,11 +510,6 @@ int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
|
||||
{
|
||||
cellAudio->Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.GetAddr(), portNum.GetAddr());
|
||||
|
||||
if(!audioParam.IsGood() || !portNum.IsGood())
|
||||
{
|
||||
return CELL_AUDIO_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (audioParam->nChannel > 8 || audioParam->nBlock > 16)
|
||||
{
|
||||
return CELL_AUDIO_ERROR_PARAM;
|
||||
@ -562,7 +558,7 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfi
|
||||
{
|
||||
cellAudio->Warning("cellAudioGetPortConfig(portNum=0x%x, portConfig_addr=0x%x)", portNum, portConfig.GetAddr());
|
||||
|
||||
if (!portConfig.IsGood() || portNum >= m_config.AUDIO_PORT_COUNT)
|
||||
if (portNum >= m_config.AUDIO_PORT_COUNT)
|
||||
{
|
||||
return CELL_AUDIO_ERROR_PARAM;
|
||||
}
|
||||
|
@ -460,11 +460,6 @@ int cellDmuxQueryAttr(const mem_ptr_t<CellDmuxType> demuxerType, mem_ptr_t<CellD
|
||||
{
|
||||
cellDmux->Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.GetAddr(), demuxerAttr.GetAddr());
|
||||
|
||||
if (!demuxerType.IsGood() || !demuxerAttr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
@ -478,11 +473,6 @@ int cellDmuxQueryAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, mem_ptr_t<Ce
|
||||
{
|
||||
cellDmux->Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.GetAddr(), demuxerAttr.GetAddr());
|
||||
|
||||
if (!demuxerType2.IsGood() || !demuxerAttr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
@ -498,21 +488,11 @@ int cellDmuxOpen(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<Cell
|
||||
cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
|
||||
demuxerType.GetAddr(), demuxerResource.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
|
||||
|
||||
if (!demuxerType.IsGood() || !demuxerResource.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(demuxerResource->memAddr, demuxerResource->memSize))
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
// TODO: check demuxerResource and demuxerCb arguments
|
||||
|
||||
demuxerHandle = dmuxOpen(new Demuxer(demuxerResource->memAddr, demuxerResource->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg_addr));
|
||||
@ -526,21 +506,11 @@ int cellDmuxOpenEx(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<Ce
|
||||
cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
|
||||
demuxerType.GetAddr(), demuxerResourceEx.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
|
||||
|
||||
if (!demuxerType.IsGood() || !demuxerResourceEx.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(demuxerResourceEx->memAddr, demuxerResourceEx->memSize))
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
// TODO: check demuxerResourceEx and demuxerCb arguments
|
||||
|
||||
demuxerHandle = dmuxOpen(new Demuxer(demuxerResourceEx->memAddr, demuxerResourceEx->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg_addr));
|
||||
@ -554,21 +524,11 @@ int cellDmuxOpen2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<C
|
||||
cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
|
||||
demuxerType2.GetAddr(), demuxerResource2.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
|
||||
|
||||
if (!demuxerType2.IsGood() || !demuxerResource2.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(demuxerResource2->memAddr, demuxerResource2->memSize))
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
// TODO: check demuxerType2, demuxerResource2 and demuxerCb arguments
|
||||
|
||||
demuxerHandle = dmuxOpen(new Demuxer(demuxerResource2->memAddr, demuxerResource2->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg_addr));
|
||||
@ -615,11 +575,6 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(streamAddress, streamSize))
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (dmux->is_running)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
@ -701,17 +656,6 @@ int cellDmuxQueryEsAttr(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr
|
||||
cellDmux->Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)",
|
||||
demuxerType.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr());
|
||||
|
||||
if (!demuxerType.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12))
|
||||
{
|
||||
cellDmux->Error("cellDmuxQueryEsAttr: invalid specific info addr (0x%x)", esSpecificInfo_addr);
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
@ -729,17 +673,6 @@ int cellDmuxQueryEsAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_
|
||||
cellDmux->Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)",
|
||||
demuxerType2.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr());
|
||||
|
||||
if (!demuxerType2.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12))
|
||||
{
|
||||
cellDmux->Error("cellDmuxQueryEsAttr2: invalid specific info addr (0x%x)", esSpecificInfo_addr);
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
|
||||
{
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
@ -759,22 +692,6 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t<CellCodecEsFilterId> esF
|
||||
"esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.GetAddr(), esResourceInfo.GetAddr(),
|
||||
esCb.GetAddr(), esSpecificInfo_addr, esHandle.GetAddr());
|
||||
|
||||
if (!esFilterId.IsGood() || !esResourceInfo.IsGood() || !esCb.IsGood() || !esHandle.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12))
|
||||
{
|
||||
cellDmux->Error("cellDmuxEnableEs: invalid specific info addr (0x%x)", esSpecificInfo_addr);
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(esResourceInfo->memAddr, esResourceInfo->memSize))
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
Demuxer* dmux;
|
||||
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
|
||||
{
|
||||
@ -849,11 +766,6 @@ int cellDmuxGetAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr)
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!auInfo_ptr.IsGood() || !auSpecificInfo_ptr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
u32 info;
|
||||
u32 spec;
|
||||
if (!es->peek(info, true, spec, true))
|
||||
@ -877,11 +789,6 @@ int cellDmuxPeekAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr)
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!auInfo_ptr.IsGood() || !auSpecificInfo_ptr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
u32 info;
|
||||
u32 spec;
|
||||
if (!es->peek(info, true, spec, false))
|
||||
@ -905,11 +812,6 @@ int cellDmuxGetAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_p
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!auInfoEx_ptr.IsGood() || !auSpecificInfo_ptr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
u32 info;
|
||||
u32 spec;
|
||||
if (!es->peek(info, false, spec, true))
|
||||
@ -933,11 +835,6 @@ int cellDmuxPeekAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_
|
||||
return CELL_DMUX_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!auInfoEx_ptr.IsGood() || !auSpecificInfo_ptr.IsGood())
|
||||
{
|
||||
return CELL_DMUX_ERROR_FATAL;
|
||||
}
|
||||
|
||||
u32 info;
|
||||
u32 spec;
|
||||
if (!es->peek(info, false, spec, false))
|
||||
|
@ -632,12 +632,7 @@ public:
|
||||
|
||||
u32 data_addr = put + 128 + size;
|
||||
size += sz;
|
||||
if (!Memory.Copy(data_addr, stream.addr, sz))
|
||||
{
|
||||
LOG_ERROR(HLE, "es::push(): data copying failed");
|
||||
Emu.Pause();
|
||||
return;
|
||||
}
|
||||
memcpy(Memory + data_addr, Memory + stream.addr, sz);
|
||||
stream.skip(sz);
|
||||
|
||||
mem_ptr_t<CellDmuxAuInfoEx> info(put);
|
||||
|
@ -242,10 +242,6 @@ int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig>
|
||||
|
||||
if (s_fontInternalInstance->m_bInitialized)
|
||||
return CELL_FONT_ERROR_ALREADY_INITIALIZED;
|
||||
if (!config.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!Memory.IsGoodAddr(config->FileCache.buffer_addr))
|
||||
return CELL_FONT_ERROR_INVALID_CACHE_BUFFER;
|
||||
if (config->FileCache.size < 24)
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (config->flags != 0)
|
||||
@ -299,10 +295,6 @@ int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32
|
||||
|
||||
if (!s_fontInternalInstance->m_bInitialized)
|
||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||
if (!library.IsGood() || !font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!Memory.IsGoodAddr(fontAddr))
|
||||
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
|
||||
|
||||
if (!stbtt_InitFont(&(font->stbfont), (unsigned char*)Memory.VirtualToRealAddr(fontAddr), 0))
|
||||
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
|
||||
@ -336,8 +328,6 @@ int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontTy
|
||||
cellFont->Log("cellFontOpenFontset(library_addr=0x%x, fontType_addr=0x%x, font_addr=0x%x)",
|
||||
library.GetAddr(), fontType.GetAddr(), font.GetAddr());
|
||||
|
||||
if (!library.IsGood() || !fontType.IsGood() || !font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!s_fontInternalInstance->m_bInitialized)
|
||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||
if (fontType->map != CELL_FONT_MAP_UNICODE)
|
||||
@ -421,9 +411,6 @@ int cellFontOpenFontInstance(mem_ptr_t<CellFont> openedFont, mem_ptr_t<CellFont>
|
||||
{
|
||||
cellFont->Warning("cellFontOpenFontInstance(openedFont=0x%x, font=0x%x)", openedFont.GetAddr(), font.GetAddr());
|
||||
|
||||
if (!openedFont.IsGood() || !font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
font->renderer_addr = openedFont->renderer_addr;
|
||||
font->scale_x = openedFont->scale_x;
|
||||
font->scale_y = openedFont->scale_y;
|
||||
@ -446,8 +433,6 @@ int cellFontCreateRenderer(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFon
|
||||
cellFont->Warning("cellFontCreateRenderer(library_addr=0x%x, config_addr=0x%x, Renderer_addr=0x%x)",
|
||||
library.GetAddr(), config.GetAddr(), Renderer.GetAddr());
|
||||
|
||||
if (!library.IsGood() || !config.IsGood() || !Renderer.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!s_fontInternalInstance->m_bInitialized)
|
||||
return CELL_FONT_ERROR_UNINITIALIZED;
|
||||
|
||||
@ -488,9 +473,6 @@ int cellFontSetScalePixel(mem_ptr_t<CellFont> font, float w, float h)
|
||||
h = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments
|
||||
cellFont->Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h);
|
||||
|
||||
if (!font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
font->scale_x = w;
|
||||
font->scale_y = h;
|
||||
return CELL_FONT_OK;
|
||||
@ -501,9 +483,6 @@ int cellFontGetHorizontalLayout(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontHori
|
||||
cellFont->Log("cellFontGetHorizontalLayout(font_addr=0x%x, layout_addr=0x%x)",
|
||||
font.GetAddr(), layout.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !layout.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
int ascent, descent, lineGap;
|
||||
float scale = stbtt_ScaleForPixelHeight(&(font->stbfont), font->scale_y);
|
||||
stbtt_GetFontVMetrics(&(font->stbfont), &ascent, &descent, &lineGap);
|
||||
@ -518,9 +497,7 @@ int cellFontBindRenderer(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontRenderer> r
|
||||
{
|
||||
cellFont->Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)",
|
||||
font.GetAddr(), renderer.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !renderer.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (font->renderer_addr)
|
||||
return CELL_FONT_ERROR_RENDERER_ALREADY_BIND;
|
||||
|
||||
@ -532,8 +509,6 @@ int cellFontUnbindRenderer(mem_ptr_t<CellFont> font)
|
||||
{
|
||||
cellFont->Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr());
|
||||
|
||||
if (!font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!font->renderer_addr)
|
||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||
|
||||
@ -553,8 +528,6 @@ int cellFontSetupRenderScalePixel(mem_ptr_t<CellFont> font, float w, float h)
|
||||
h = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments
|
||||
cellFont->Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h);
|
||||
|
||||
if (!font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!font->renderer_addr)
|
||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||
|
||||
@ -567,8 +540,6 @@ int cellFontGetRenderCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_pt
|
||||
cellFont->Log("cellFontGetRenderCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)",
|
||||
font.GetAddr(), code, metrics.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !metrics.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!font->renderer_addr)
|
||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||
|
||||
@ -583,8 +554,6 @@ int cellFontRenderCharGlyphImage(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<C
|
||||
cellFont->Log("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)",
|
||||
font.GetAddr(), code, surface.GetAddr(), x, y, metrics.GetAddr(), transInfo.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !surface.IsGood() || !metrics.IsGood() || !transInfo.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
if (!font->renderer_addr)
|
||||
return CELL_FONT_ERROR_RENDERER_UNBIND;
|
||||
|
||||
@ -629,7 +598,7 @@ int cellFontSetEffectSlant(mem_ptr_t<CellFont> font, float slantParam)
|
||||
slantParam = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
|
||||
cellFont->Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.GetAddr(), slantParam);
|
||||
|
||||
if (!font.IsGood() || slantParam < -1.0 || slantParam > 1.0)
|
||||
if (slantParam < -1.0 || slantParam > 1.0)
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
font->slant = slantParam;
|
||||
@ -640,21 +609,15 @@ int cellFontGetEffectSlant(mem_ptr_t<CellFont> font, mem32_t slantParam)
|
||||
{
|
||||
cellFont->Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.GetAddr(), slantParam.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !slantParam.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
slantParam = font->slant; //Does this conversion from be_t<float> to *mem32_t work?
|
||||
return CELL_FONT_OK;
|
||||
}
|
||||
|
||||
int cellFontGetFontIdCode(mem_ptr_t<CellFont> font, u32 code, mem32_t fontId, mem32_t fontCode)
|
||||
{
|
||||
cellFont->Log("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
|
||||
cellFont->Todo("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
|
||||
font.GetAddr(), code, fontId.GetAddr(), fontCode.GetAddr());
|
||||
|
||||
if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
// TODO: ?
|
||||
return CELL_FONT_OK;
|
||||
}
|
||||
@ -663,9 +626,6 @@ int cellFontCloseFont(mem_ptr_t<CellFont> font)
|
||||
{
|
||||
cellFont->Warning("cellFontCloseFont(font_addr=0x%x)", font.GetAddr());
|
||||
|
||||
if (!font.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
if (font->origin == CELL_FONT_OPEN_FONTSET ||
|
||||
font->origin == CELL_FONT_OPEN_FONT_FILE ||
|
||||
font->origin == CELL_FONT_OPEN_MEMORY)
|
||||
@ -679,9 +639,6 @@ int cellFontGetCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<Ce
|
||||
cellFont->Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x",
|
||||
font.GetAddr(), code, metrics.GetAddr());
|
||||
|
||||
if (!font.IsGood() || metrics.IsGood())
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
|
||||
int x0, y0, x1, y1;
|
||||
int advanceWidth, leftSideBearing;
|
||||
float scale = stbtt_ScaleForPixelHeight(&(font->stbfont), font->scale_y);
|
||||
|
@ -46,8 +46,6 @@ int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t<CellFon
|
||||
cellFontFT->Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config_addr=0x%x, lib_addr_addr=0x%x",
|
||||
revisionFlags, config.GetAddr(), lib_addr_addr);
|
||||
|
||||
if (!config.IsGood() || !Memory.IsGoodAddr(lib_addr_addr))
|
||||
return CELL_FONT_ERROR_INVALID_PARAMETER;
|
||||
//if (s_fontInternalInstance->m_bInitialized)
|
||||
//return CELL_FONT_ERROR_UNINITIALIZED;
|
||||
|
||||
|
@ -23,12 +23,6 @@ int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameConten
|
||||
cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
|
||||
type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || (dirName.GetAddr() && !dirName.IsGood()))
|
||||
{
|
||||
cellGame->Error("cellGameBootCheck(): CELL_GAME_ERROR_PARAM");
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
}
|
||||
|
||||
// TODO: Use the free space of the computer's HDD where RPCS3 is being run.
|
||||
size->hddFreeSizeKB = 40000000; // 40 GB
|
||||
|
||||
@ -90,7 +84,7 @@ int cellGamePatchCheck(mem_ptr_t<CellGameContentSize> size, u32 reserved_addr)
|
||||
{
|
||||
cellGame->Warning("cellGamePatchCheck(size_addr=0x%x, reserved_addr=0x%x)", size.GetAddr(), reserved_addr);
|
||||
|
||||
if (!size.IsGood() || reserved_addr != 0)
|
||||
if (reserved_addr != 0)
|
||||
{
|
||||
cellGame->Error("cellGamePatchCheck(): CELL_GAME_ERROR_PARAM");
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
@ -135,7 +129,7 @@ int cellGameDataCheck(u32 type, const mem_list_ptr_t<u8> dirName, mem_ptr_t<Cell
|
||||
{
|
||||
cellGame->Warning("cellGameDataCheck(type=0x%x, dirName_addr=0x%x, size_addr=0x%x)", type, dirName.GetAddr(), size.GetAddr());
|
||||
|
||||
if ((type - 1) >= 3 || !size.IsGood() || !dirName.IsGood())
|
||||
if ((type - 1) >= 3)
|
||||
{
|
||||
cellGame->Error("cellGameDataCheck(): CELL_GAME_ERROR_PARAM");
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
@ -181,12 +175,6 @@ int cellGameContentPermit(mem_list_ptr_t<u8> contentInfoPath, mem_list_ptr_t<u8>
|
||||
cellGame->Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)",
|
||||
contentInfoPath.GetAddr(), usrdirPath.GetAddr());
|
||||
|
||||
if (!contentInfoPath.IsGood() || !usrdirPath.IsGood())
|
||||
{
|
||||
cellGame->Error("cellGameContentPermit(): CELL_GAME_ERROR_PARAM");
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
}
|
||||
|
||||
if (contentInfo == "" && usrdir == "")
|
||||
{
|
||||
cellGame->Warning("cellGameContentPermit(): CELL_GAME_ERROR_FAILURE (no permission given)");
|
||||
@ -209,7 +197,7 @@ int cellGameDataCheckCreate2(u32 version, const mem_list_ptr_t<u8> dirName, u32
|
||||
cellGame->Warning("cellGameDataCheckCreate2(version=0x%x, dirName_addr=0x%x, errDialog=0x%x, funcStat_addr=0x%x, container=%d)",
|
||||
version, dirName.GetAddr(), errDialog, funcStat.GetAddr(), container);
|
||||
|
||||
if (version != CELL_GAMEDATA_VERSION_CURRENT || !dirName.IsGood() || errDialog > 1 || !funcStat.IsGood())
|
||||
if (version != CELL_GAMEDATA_VERSION_CURRENT || errDialog > 1)
|
||||
{
|
||||
cellGame->Error("cellGameDataCheckCreate2(): CELL_GAMEDATA_ERROR_PARAM");
|
||||
return CELL_GAMEDATA_ERROR_PARAM;
|
||||
@ -336,9 +324,6 @@ int cellGameGetParamInt(u32 id, mem32_t value)
|
||||
{
|
||||
cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
if(!value.IsGood())
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
|
||||
// TODO: Access through cellGame***Check functions
|
||||
vfsFile f("/app_home/PARAM.SFO");
|
||||
PSFLoader psf(f);
|
||||
@ -362,9 +347,6 @@ int cellGameGetParamString(u32 id, u32 buf_addr, u32 bufsize)
|
||||
{
|
||||
cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf_addr, bufsize);
|
||||
|
||||
if(!Memory.IsGoodAddr(buf_addr))
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
|
||||
// TODO: Access through cellGame***Check functions
|
||||
vfsFile f("/app_home/PARAM.SFO");
|
||||
PSFLoader psf(f);
|
||||
@ -437,9 +419,6 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
|
||||
{
|
||||
cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr);
|
||||
|
||||
if (Memory.IsGoodAddr(dirName_addr))
|
||||
return CELL_GAME_ERROR_PARAM;
|
||||
|
||||
char* dirName = (char*)Memory.VirtualToRealAddr(dirName_addr);
|
||||
std::string errorName;
|
||||
switch(type)
|
||||
|
@ -243,12 +243,6 @@ int cellGcmGetConfiguration(mem_ptr_t<CellGcmConfig> config)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr());
|
||||
|
||||
if (!config.IsGood())
|
||||
{
|
||||
cellGcmSys->Error("cellGcmGetConfiguration : CELL_EFAULT");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
*config = current_config;
|
||||
|
||||
return CELL_OK;
|
||||
@ -413,11 +407,6 @@ void cellGcmSetFlipHandler(u32 handler_addr)
|
||||
{
|
||||
cellGcmSys->Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler_addr);
|
||||
|
||||
if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmSetFlipHandler(handler_addr=%d): invalid address", handler_addr);
|
||||
}
|
||||
|
||||
Emu.GetGSManager().GetRender().m_flip_handler.SetAddr(handler_addr);
|
||||
}
|
||||
|
||||
@ -472,12 +461,8 @@ s32 cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
|
||||
|
||||
const s32 res = ctxt->current - ctxt->begin - ctrl.put;
|
||||
|
||||
if (res > 0 && !Memory.Copy(ctxt->begin, ctxt->current - res, res))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmSetPrepareFlip(): Memory.Copy(0x%x, 0x%x, 0x%x) failed", (u32)ctxt->begin, (u32)ctxt->current - res, res);
|
||||
Emu.Pause();
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + ctxt->begin, Memory + ctxt->current - res, res);
|
||||
|
||||
ctxt->current = ctxt->begin + res;
|
||||
|
||||
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
||||
@ -562,11 +547,6 @@ void cellGcmSetUserHandler(u32 handler_addr)
|
||||
{
|
||||
cellGcmSys->Warning("cellGcmSetUserHandler(handler_addr=0x%x)", handler_addr);
|
||||
|
||||
if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmSetUserHandler(handler_addr=%d): invalid address", handler_addr);
|
||||
}
|
||||
|
||||
Emu.GetGSManager().GetRender().m_user_handler.SetAddr(handler_addr);
|
||||
}
|
||||
|
||||
@ -574,11 +554,6 @@ void cellGcmSetVBlankHandler(u32 handler_addr)
|
||||
{
|
||||
cellGcmSys->Warning("cellGcmSetVBlankHandler(handler_addr=0x%x)", handler_addr);
|
||||
|
||||
if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmSetVBlankHandler(handler_addr=%d): invalid address", handler_addr);
|
||||
}
|
||||
|
||||
Emu.GetGSManager().GetRender().m_vblank_handler.SetAddr(handler_addr);
|
||||
}
|
||||
|
||||
@ -673,12 +648,6 @@ int cellGcmGetCurrentDisplayBufferId(u32 id_addr)
|
||||
{
|
||||
cellGcmSys->Warning("cellGcmGetCurrentDisplayBufferId(id_addr=0x%x)", id_addr);
|
||||
|
||||
if (!Memory.IsGoodAddr(id_addr))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmGetCurrentDisplayBufferId : CELL_EFAULT");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Memory.Write32(id_addr, Emu.GetGSManager().GetRender().m_gcm_current_buffer);
|
||||
|
||||
return CELL_OK;
|
||||
@ -822,17 +791,23 @@ s32 cellGcmAddressToOffset(u64 address, mem32_t offset)
|
||||
|
||||
u32 cellGcmGetMaxIoMapSize()
|
||||
{
|
||||
cellGcmSys->Log("cellGcmGetMaxIoMapSize()");
|
||||
|
||||
return Memory.RSXIOMem.GetEndAddr() - Memory.RSXIOMem.GetStartAddr() - Memory.RSXIOMem.GetReservedAmount();
|
||||
}
|
||||
|
||||
void cellGcmGetOffsetTable(mem_ptr_t<gcm_offset> table)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmGetOffsetTable(table_addr=0x%x)", table.GetAddr());
|
||||
|
||||
table->io = re(offsetTable.io);
|
||||
table->ea = re(offsetTable.ea);
|
||||
}
|
||||
|
||||
s32 cellGcmIoOffsetToAddress(u32 ioOffset, u64 address)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmIoOffsetToAddress(ioOffset=0x%x, address=0x%llx)", ioOffset, address);
|
||||
|
||||
u64 realAddr;
|
||||
|
||||
if (!Memory.RSXIOMem.getRealAddr(Memory.RSXIOMem.GetStartAddr() + ioOffset, realAddr))
|
||||
@ -876,6 +851,8 @@ s32 cellGcmMapEaIoAddressWithFlags(u32 ea, u32 io, u32 size, u32 flags)
|
||||
|
||||
s32 cellGcmMapLocalMemory(u64 address, u64 size)
|
||||
{
|
||||
cellGcmSys->Warning("cellGcmMapLocalMemory(address=0x%llx, size=0x%llx)", address, size);
|
||||
|
||||
if (!local_size && !local_addr)
|
||||
{
|
||||
local_size = 0xf900000; //TODO
|
||||
@ -929,6 +906,8 @@ s32 cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset)
|
||||
|
||||
s32 cellGcmReserveIoMapSize(u32 size)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmReserveIoMapSize(size=0x%x)", size);
|
||||
|
||||
if (size & 0xFFFFF)
|
||||
{
|
||||
cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT");
|
||||
@ -947,6 +926,8 @@ s32 cellGcmReserveIoMapSize(u32 size)
|
||||
|
||||
s32 cellGcmUnmapEaIoAddress(u64 ea)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmUnmapEaIoAddress(ea=0x%llx)", ea);
|
||||
|
||||
u32 size = Memory.RSXIOMem.UnmapRealAddress(ea);
|
||||
if (size)
|
||||
{
|
||||
@ -971,6 +952,8 @@ s32 cellGcmUnmapEaIoAddress(u64 ea)
|
||||
|
||||
s32 cellGcmUnmapIoAddress(u64 io)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmUnmapIoAddress(io=0x%llx)", io);
|
||||
|
||||
u32 size = Memory.RSXIOMem.UnmapAddress(io);
|
||||
if (size)
|
||||
{
|
||||
@ -995,6 +978,7 @@ s32 cellGcmUnmapIoAddress(u64 io)
|
||||
|
||||
s32 cellGcmUnreserveIoMapSize(u32 size)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmUnreserveIoMapSize(size=0x%x)", size);
|
||||
|
||||
if (size & 0xFFFFF)
|
||||
{
|
||||
@ -1068,6 +1052,8 @@ void cellGcmSetDefaultCommandBuffer()
|
||||
|
||||
int cellGcmSetFlipCommand(u32 ctx, u32 id)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmSetFlipCommand(ctx=0x%x, id=0x%x)", ctx, id);
|
||||
|
||||
return cellGcmSetPrepareFlip(ctx, id);
|
||||
}
|
||||
|
||||
@ -1085,6 +1071,9 @@ s64 cellGcmFunc15(u32 unk_addr)
|
||||
|
||||
int cellGcmSetFlipCommandWithWaitLabel(u32 ctx, u32 id, u32 label_index, u32 label_value)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmSetFlipCommandWithWaitLabel(ctx=0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)",
|
||||
ctx, id, label_index, label_value);
|
||||
|
||||
int res = cellGcmSetPrepareFlip(ctx, id);
|
||||
Memory.Write32(Memory.RSXCMDMem.GetStartAddr() + 0x10 * label_index, label_value);
|
||||
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
|
||||
@ -1139,6 +1128,8 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
|
||||
|
||||
int cellGcmCallback(u32 context_addr, u32 count)
|
||||
{
|
||||
cellGcmSys->Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context_addr, count);
|
||||
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
|
||||
|
||||
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
|
||||
@ -1146,12 +1137,7 @@ int cellGcmCallback(u32 context_addr, u32 count)
|
||||
|
||||
const s32 res = ctx.current - ctx.begin - ctrl.put;
|
||||
|
||||
if (res > 0 && !Memory.Copy(ctx.begin, ctx.current - res, res))
|
||||
{
|
||||
cellGcmSys->Error("cellGcmCallback(): Memory.Copy(0x%x, 0x%x, 0x%x) failed", (u32)ctx.begin, (u32)ctx.current - res, res);
|
||||
Emu.Pause();
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + ctx.begin, Memory + ctx.current - res, res);
|
||||
|
||||
ctx.current = ctx.begin + res;
|
||||
|
||||
|
@ -27,9 +27,9 @@ int cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u
|
||||
|
||||
int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDecSrc> src, mem_ptr_t<CellGifDecOpnInfo> openInfo)
|
||||
{
|
||||
if (!subHandle.IsGood() || !src.IsGood())
|
||||
return CELL_GIFDEC_ERROR_ARG;
|
||||
|
||||
cellGifDec->Warning("cellGifDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
|
||||
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo.GetAddr());
|
||||
|
||||
CellGifDecSubHandle *current_subHandle = new CellGifDecSubHandle;
|
||||
current_subHandle->fd = 0;
|
||||
current_subHandle->src = *src;
|
||||
@ -63,8 +63,8 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDec
|
||||
|
||||
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo> info)
|
||||
{
|
||||
if (!info.IsGood())
|
||||
return CELL_GIFDEC_ERROR_ARG;
|
||||
cellGifDec->Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)",
|
||||
mainHandle, subHandle, info.GetAddr());
|
||||
|
||||
CellGifDecSubHandle* subHandle_data;
|
||||
if(!cellGifDec->CheckId(subHandle, subHandle_data))
|
||||
@ -81,10 +81,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_GIFDEC_BUFFER):
|
||||
if (!Memory.Copy(buffer.GetAddr(), subHandle_data->src.streamPtr.ToLE(), buffer.GetSize())) {
|
||||
cellGifDec->Error("cellGifDecReadHeader() failed ()");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + buffer.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), buffer.GetSize());
|
||||
break;
|
||||
|
||||
case se32(CELL_GIFDEC_FILE):
|
||||
@ -116,8 +113,8 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo
|
||||
|
||||
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGifDecInParam> inParam, mem_ptr_t<CellGifDecOutParam> outParam)
|
||||
{
|
||||
if (!inParam.IsGood() || !outParam.IsGood())
|
||||
return CELL_GIFDEC_ERROR_ARG;
|
||||
cellGifDec->Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
|
||||
mainHandle, subHandle, inParam.GetAddr(), outParam.GetAddr());
|
||||
|
||||
CellGifDecSubHandle* subHandle_data;
|
||||
if(!cellGifDec->CheckId(subHandle, subHandle_data))
|
||||
@ -146,8 +143,8 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGi
|
||||
|
||||
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellGifDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellGifDecDataOutInfo> dataOutInfo)
|
||||
{
|
||||
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
|
||||
return CELL_GIFDEC_ERROR_ARG;
|
||||
cellGifDec->Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
|
||||
mainHandle, subHandle, data.GetAddr(), dataCtrlParam.GetAddr(), dataOutInfo.GetAddr());
|
||||
|
||||
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
|
||||
|
||||
@ -166,10 +163,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_GIFDEC_BUFFER):
|
||||
if (!Memory.Copy(gif.GetAddr(), subHandle_data->src.streamPtr.ToLE(), gif.GetSize())) {
|
||||
cellGifDec->Error("cellGifDecDecodeData() failed (I)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + gif.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), gif.GetSize());
|
||||
break;
|
||||
|
||||
case se32(CELL_GIFDEC_FILE):
|
||||
@ -204,20 +198,12 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
{
|
||||
const int dstOffset = i * bytesPerLine;
|
||||
const int srcOffset = width * nComponents * i;
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize))
|
||||
{
|
||||
cellGifDec->Error("cellGifDecDecodeData() failed (II)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Memory.CopyFromReal(data.GetAddr(), image.get(), image_size))
|
||||
{
|
||||
cellGifDec->Error("cellGifDecDecodeData() failed (III)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr(), image.get(), image_size);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -240,11 +226,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
output[j + 2] = image.get()[srcOffset + j + 1];
|
||||
output[j + 3] = image.get()[srcOffset + j + 2];
|
||||
}
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, output, linesize))
|
||||
{
|
||||
cellGifDec->Error("cellGifDecDecodeData() failed (IV)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, output, linesize);
|
||||
}
|
||||
free(output);
|
||||
}
|
||||
@ -279,6 +261,9 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
|
||||
int cellGifDecClose(u32 mainHandle, u32 subHandle)
|
||||
{
|
||||
cellGifDec->Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)",
|
||||
mainHandle, subHandle);
|
||||
|
||||
CellGifDecSubHandle* subHandle_data;
|
||||
if(!cellGifDec->CheckId(subHandle, subHandle_data))
|
||||
return CELL_GIFDEC_ERROR_FATAL;
|
||||
|
@ -30,11 +30,8 @@ int cellJpgDecDestroy(u32 mainHandle)
|
||||
|
||||
int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> src, mem_ptr_t<CellJpgDecOpnInfo> openInfo)
|
||||
{
|
||||
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
|
||||
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
|
||||
|
||||
if (!subHandle.IsGood() || !src.IsGood())
|
||||
return CELL_JPGDEC_ERROR_ARG;
|
||||
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle_addr=0x%x, src_addr=0x%x, openInfo_addr=0x%x)",
|
||||
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo.GetAddr());
|
||||
|
||||
CellJpgDecSubHandle *current_subHandle = new CellJpgDecSubHandle;
|
||||
|
||||
@ -70,6 +67,9 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> s
|
||||
|
||||
int cellJpgDecClose(u32 mainHandle, u32 subHandle)
|
||||
{
|
||||
cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x)",
|
||||
mainHandle, subHandle);
|
||||
|
||||
CellJpgDecSubHandle* subHandle_data;
|
||||
if(!cellJpgDec->CheckId(subHandle, subHandle_data))
|
||||
return CELL_JPGDEC_ERROR_FATAL;
|
||||
@ -82,10 +82,7 @@ int cellJpgDecClose(u32 mainHandle, u32 subHandle)
|
||||
|
||||
int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo> info)
|
||||
{
|
||||
cellJpgDec->Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
|
||||
|
||||
if (!info.IsGood())
|
||||
return CELL_JPGDEC_ERROR_ARG;
|
||||
cellJpgDec->Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", mainHandle, subHandle, info.GetAddr());
|
||||
|
||||
CellJpgDecSubHandle* subHandle_data;
|
||||
if(!cellJpgDec->CheckId(subHandle, subHandle_data))
|
||||
@ -102,10 +99,7 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_JPGDEC_BUFFER):
|
||||
if (!Memory.Copy(buffer.GetAddr(), subHandle_data->src.streamPtr.ToLE(), buffer.GetSize())) {
|
||||
cellJpgDec->Error("cellJpgDecReadHeader() failed ()");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + buffer.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), buffer.GetSize());
|
||||
break;
|
||||
|
||||
case se32(CELL_JPGDEC_FILE):
|
||||
@ -155,8 +149,8 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo
|
||||
|
||||
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellJpgDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellJpgDecDataOutInfo> dataOutInfo)
|
||||
{
|
||||
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
|
||||
return CELL_JPGDEC_ERROR_ARG;
|
||||
cellJpgDec->Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
|
||||
mainHandle, subHandle, data.GetAddr(), dataCtrlParam.GetAddr(), dataOutInfo.GetAddr());
|
||||
|
||||
dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
|
||||
CellJpgDecSubHandle* subHandle_data;
|
||||
@ -174,10 +168,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_JPGDEC_BUFFER):
|
||||
if (!Memory.Copy(jpg.GetAddr(), subHandle_data->src.streamPtr.ToLE(), jpg.GetSize())) {
|
||||
cellJpgDec->Error("cellJpgDecDecodeData() failed (I)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + jpg.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), jpg.GetSize());
|
||||
break;
|
||||
|
||||
case se32(CELL_JPGDEC_FILE):
|
||||
@ -215,20 +206,12 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
{
|
||||
const int dstOffset = i * bytesPerLine;
|
||||
const int srcOffset = width * nComponents * (flip ? height - i - 1 : i);
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize))
|
||||
{
|
||||
cellJpgDec->Error("cellJpgDecDecodeData() failed (II)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Memory.CopyFromReal(data.GetAddr(), image.get(), image_size))
|
||||
{
|
||||
cellJpgDec->Error("cellJpgDecDecodeData() failed (III)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr(), image.get(), image_size);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -253,11 +236,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
output[j + 2] = image.get()[srcOffset + j + 1];
|
||||
output[j + 3] = image.get()[srcOffset + j + 2];
|
||||
}
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, output, linesize))
|
||||
{
|
||||
cellJpgDec->Error("cellJpgDecDecodeData() failed (IV)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, output, linesize);
|
||||
}
|
||||
free(output);
|
||||
}
|
||||
@ -302,8 +281,8 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
|
||||
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellJpgDecInParam> inParam, mem_ptr_t<CellJpgDecOutParam> outParam)
|
||||
{
|
||||
if (!inParam.IsGood() || !outParam.IsGood())
|
||||
return CELL_JPGDEC_ERROR_ARG;
|
||||
cellJpgDec->Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
|
||||
mainHandle, subHandle, inParam.GetAddr(), outParam.GetAddr());
|
||||
|
||||
CellJpgDecSubHandle* subHandle_data;
|
||||
if(!cellJpgDec->CheckId(subHandle, subHandle_data))
|
||||
|
@ -41,16 +41,13 @@ int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t
|
||||
cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
|
||||
utf16.GetAddr(), utf16_len.GetAddr(), utf8.GetAddr(), utf8_len.GetAddr());
|
||||
|
||||
if (!utf16.IsGood() || !utf16_len.IsGood() || !utf8_len.IsGood())
|
||||
return SRCIllegal;
|
||||
|
||||
std::u16string wstr =(char16_t*)Memory.VirtualToRealAddr(utf16.GetAddr());
|
||||
wstr.resize(utf16_len.GetValue()); // TODO: Is this really the role of utf16_len in this function?
|
||||
#ifdef _MSC_VER
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
|
||||
std::string str = convert.to_bytes(wstr);
|
||||
|
||||
if (!utf8.IsGood() || utf8_len.GetValue() < str.size())
|
||||
if (utf8_len.GetValue() < str.size())
|
||||
{
|
||||
utf8_len = str.size();
|
||||
return DSTExhausted;
|
||||
@ -64,12 +61,7 @@ int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t
|
||||
|
||||
int jstrchk(mem8_ptr_t jstr)
|
||||
{
|
||||
if (!jstr.IsGood())
|
||||
cellL10n->Error("jstrchk(jstr_addr=0x%x): invalid address", jstr.GetAddr());
|
||||
else if (jstr[0])
|
||||
cellL10n->Log("jstrchk(jstr_addr=0x%x): utf-8: [%s]", jstr.GetAddr(), Memory.ReadString(jstr.GetAddr()).c_str());
|
||||
else
|
||||
cellL10n->Log("jstrchk(jstr_addr=0x%x): empty string", jstr.GetAddr());
|
||||
cellL10n->Warning("jstrchk(jstr_addr=0x%x) -> utf8", jstr.GetAddr());
|
||||
|
||||
return L10N_STR_UTF8;
|
||||
}
|
||||
|
@ -31,11 +31,6 @@ int cellMsgDialogOpen2(u32 type, mem_list_ptr_t<u8> msgString, mem_func_ptr_t<Ce
|
||||
cellSysutil->Warning("cellMsgDialogOpen2(type=0x%x, msgString_addr=0x%x, callback_addr=0x%x, userData=0x%x, extParam=0x%x)",
|
||||
type, msgString.GetAddr(), callback.GetAddr(), userData, extParam);
|
||||
|
||||
if (!msgString.IsGood() || !callback.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
//type |= CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE;
|
||||
//type |= CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO;
|
||||
|
||||
@ -356,13 +351,6 @@ int cellMsgDialogAbort()
|
||||
|
||||
int cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, mem_list_ptr_t<u8> msgString)
|
||||
{
|
||||
if (!msgString.IsGood())
|
||||
{
|
||||
cellSysutil->Error("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString_addr=0x%x): CELL_EFAULT",
|
||||
progressBarIndex, msgString.GetAddr());
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
cellSysutil->Warning("cellMsgDialogProgressBarSetMsg(progressBarIndex=%d, msgString_addr=0x%x): '%s'",
|
||||
progressBarIndex, msgString.GetAddr(), msgString.GetString());
|
||||
|
||||
|
@ -26,12 +26,6 @@ int cellNetCtlGetState(mem32_t state)
|
||||
{
|
||||
cellNetCtl->Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr());
|
||||
|
||||
if (!state.IsGood())
|
||||
{
|
||||
cellNetCtl->Error("cellNetCtlGetState : CELL_NET_CTL_ERROR_INVALID_ADDR");
|
||||
return CELL_NET_CTL_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -58,12 +52,6 @@ int cellNetCtlNetStartDialogLoadAsync(mem_ptr_t<CellNetCtlNetStartDialogParam> p
|
||||
{
|
||||
cellNetCtl->Todo("cellNetCtlNetStartDialogLoadAsync(param_addr=0x%x)", param.GetAddr());
|
||||
|
||||
if (!param.IsGood())
|
||||
{
|
||||
cellNetCtl->Error("cellNetCtlNetStartDialogLoadAsync : CELL_NET_CTL_ERROR_INVALID_ADDR");
|
||||
return CELL_NET_CTL_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -77,12 +65,6 @@ int cellNetCtlNetStartDialogUnloadAsync(mem_ptr_t<CellNetCtlNetStartDialogResult
|
||||
{
|
||||
cellNetCtl->Todo("cellNetCtlNetStartDialogUnloadAsync(result_addr=0x%x)", result.GetAddr());
|
||||
|
||||
if (!result.IsGood())
|
||||
{
|
||||
cellNetCtl->Error("cellNetCtlNetStartDialogLoadAsync : CELL_NET_CTL_ERROR_INVALID_ADDR");
|
||||
return CELL_NET_CTL_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -90,12 +72,6 @@ int cellNetCtlGetNatInfo(mem_ptr_t<CellNetCtlNatInfo> natInfo)
|
||||
{
|
||||
cellNetCtl->Todo("cellNetCtlGetNatInfo(natInfo_addr=0x%x)", natInfo.GetAddr());
|
||||
|
||||
if (!natInfo.IsGood())
|
||||
{
|
||||
cellNetCtl->Error("cellNetCtlGetNatInfo : CELL_NET_CTL_ERROR_INVALID_ADDR");
|
||||
return CELL_NET_CTL_ERROR_INVALID_ADDR;
|
||||
}
|
||||
|
||||
if (natInfo->size == 0)
|
||||
{
|
||||
cellNetCtl->Error("cellNetCtlGetNatInfo : CELL_NET_CTL_ERROR_INVALID_SIZE");
|
||||
|
@ -132,12 +132,6 @@ int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pSi
|
||||
{
|
||||
cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.GetAddr());
|
||||
|
||||
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfGetHeaderSize: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
//if ((u32)pAddr->magic != 0x464d4150)
|
||||
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
|
||||
|
||||
@ -150,12 +144,6 @@ int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attrib
|
||||
{
|
||||
cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr());
|
||||
|
||||
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfGetHeaderSize2: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
//if ((u32)pAddr->magic != 0x464d4150)
|
||||
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
|
||||
|
||||
@ -168,12 +156,6 @@ int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, me
|
||||
{
|
||||
cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr());
|
||||
|
||||
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pOffset.IsGood() || !pSize.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfGetStreamOffsetAndSize: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
//if ((u32)pAddr->magic != 0x464d4150)
|
||||
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
|
||||
|
||||
@ -188,12 +170,6 @@ int cellPamfVerify(mem_ptr_t<PamfHeader> pAddr, u64 fileSize)
|
||||
{
|
||||
cellPamf->Warning("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.GetAddr(), fileSize);
|
||||
|
||||
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048))
|
||||
{
|
||||
cellPamf->Error("cellPamfVerify: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -201,13 +177,6 @@ int cellPamfReaderInitialize(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<PamfHead
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pAddr.GetAddr(), 2048))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderInitialize: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
|
||||
}
|
||||
|
||||
if (fileSize)
|
||||
{
|
||||
pSelf->fileSize = fileSize;
|
||||
@ -231,12 +200,6 @@ int cellPamfReaderGetPresentationStartTime(mem_ptr_t<CellPamfReader> pSelf, mem_
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetPresentationStartTime: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
const u32 upper = (u16)pAddr->start_pts_high;
|
||||
pTimeStamp->upper = upper;
|
||||
@ -248,12 +211,6 @@ int cellPamfReaderGetPresentationEndTime(mem_ptr_t<CellPamfReader> pSelf, mem_pt
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetPresentationEndTime: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
const u32 upper = (u16)pAddr->end_pts_high;
|
||||
pTimeStamp->upper = upper;
|
||||
@ -265,12 +222,6 @@ int cellPamfReaderGetMuxRateBound(mem_ptr_t<CellPamfReader> pSelf)
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetMuxRateBound: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
return pAddr->mux_rate_max;
|
||||
}
|
||||
@ -279,12 +230,6 @@ int cellPamfReaderGetNumberOfStreams(mem_ptr_t<CellPamfReader> pSelf)
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetNumberOfStreams: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
return pAddr->stream_count;
|
||||
}
|
||||
@ -293,12 +238,6 @@ int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t<CellPamfReader> pSelf, u8
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.GetAddr(), streamType);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetNumberOfSpecificStreams: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
|
||||
int counts[6] = {0, 0, 0, 0, 0, 0};
|
||||
@ -330,12 +269,6 @@ int cellPamfReaderSetStreamWithIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamI
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.GetAddr(), streamIndex);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderSetStreamWithIndex: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
|
||||
if (streamIndex < pAddr->stream_count)
|
||||
@ -354,12 +287,6 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, u
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.GetAddr(), streamType, ch);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderSetStreamWithTypeAndChannel: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
|
||||
if (streamType > 5)
|
||||
@ -388,12 +315,6 @@ int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t<CellPamfReader> pSelf, u8
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.GetAddr(), streamType, streamIndex);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderSetStreamWithTypeAndIndex: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
|
||||
u32 found = 0;
|
||||
@ -441,12 +362,6 @@ int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId
|
||||
{
|
||||
cellPamf->Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", type, ch, pEsFilterId.GetAddr());
|
||||
|
||||
if (!pEsFilterId.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfStreamTypeToEsFilterId: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return pamfStreamTypeToEsFilterId(type, ch, pEsFilterId);
|
||||
}
|
||||
|
||||
@ -454,12 +369,6 @@ int cellPamfReaderGetStreamIndex(mem_ptr_t<CellPamfReader> pSelf)
|
||||
{
|
||||
cellPamf->Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetStreamIndex: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return pSelf->stream;
|
||||
}
|
||||
|
||||
@ -467,12 +376,6 @@ int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, mem8_
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !pCh.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetStreamTypeAndChannel: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
pType = pamfGetStreamType(pSelf, pSelf->stream);
|
||||
pCh = pamfGetStreamChannel(pSelf, pSelf->stream);
|
||||
return CELL_OK;
|
||||
@ -482,12 +385,6 @@ int cellPamfReaderGetEsFilterId(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellC
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, pEsFilterId.GetAddr());
|
||||
|
||||
if (!pSelf.IsGood() || !pEsFilterId.IsGood())
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetEsFilterId: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return pamfStreamTypeToEsFilterId(pamfGetStreamType(pSelf, pSelf->stream),
|
||||
pamfGetStreamChannel(pSelf, pSelf->stream), pEsFilterId);
|
||||
}
|
||||
@ -496,12 +393,6 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x, stream=%d, pInfo_addr=0x%x, size=%d)", pSelf.GetAddr(), pSelf->stream, pInfo_addr, size);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetStreamInfo: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
|
||||
memset(Memory + pInfo_addr, 0, size);
|
||||
@ -609,12 +500,6 @@ int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf)
|
||||
{
|
||||
cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x, stream=%d)", pSelf.GetAddr(), pSelf->stream);
|
||||
|
||||
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetNumberOfEp: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
return pAddr->stream_headers[pSelf->stream].ep_num;
|
||||
}
|
||||
@ -623,12 +508,6 @@ int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 ep
|
||||
{
|
||||
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))
|
||||
{
|
||||
cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex: CELL_PAMF_ERROR_INVALID_ARG");
|
||||
return CELL_PAMF_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
|
||||
//TODO:
|
||||
return CELL_OK;
|
||||
|
@ -56,9 +56,6 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
|
||||
cellPngDec->Warning("cellPngDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
|
||||
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
|
||||
|
||||
if (!subHandle.IsGood() || !src.IsGood())
|
||||
return CELL_PNGDEC_ERROR_ARG;
|
||||
|
||||
CellPngDecSubHandle *current_subHandle = new CellPngDecSubHandle;
|
||||
current_subHandle->fd = 0;
|
||||
current_subHandle->src = *src;
|
||||
@ -123,9 +120,6 @@ int cellPngDecClose(u32 mainHandle, u32 subHandle)
|
||||
|
||||
int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo> info)
|
||||
{
|
||||
if (!info.IsGood())
|
||||
return CELL_PNGDEC_ERROR_ARG;
|
||||
|
||||
cellPngDec->Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%x)", mainHandle, subHandle, info.GetAddr());
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec->CheckId(subHandle, subHandle_data))
|
||||
@ -145,11 +139,7 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_PNGDEC_BUFFER):
|
||||
if (!Memory.Copy(buffer.GetAddr(), subHandle_data->src.streamPtr.ToLE(), buffer.GetSize()))
|
||||
{
|
||||
cellPngDec->Error("cellPngDecReadHeader() failed ()");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + buffer.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), buffer.GetSize());
|
||||
break;
|
||||
case se32(CELL_PNGDEC_FILE):
|
||||
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.GetAddr());
|
||||
@ -195,8 +185,8 @@ int cellPngDecExtReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecI
|
||||
|
||||
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellPngDecDataOutInfo> dataOutInfo)
|
||||
{
|
||||
if (!data.IsGood() || !dataCtrlParam.IsGood() || !dataOutInfo.IsGood())
|
||||
return CELL_PNGDEC_ERROR_ARG;
|
||||
cellPngDec->Warning("cellPngDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
|
||||
mainHandle, subHandle, data.GetAddr(), dataCtrlParam.GetAddr(), dataOutInfo.GetAddr());
|
||||
|
||||
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
@ -214,10 +204,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
switch(subHandle_data->src.srcSelect.ToBE())
|
||||
{
|
||||
case se32(CELL_PNGDEC_BUFFER):
|
||||
if (!Memory.Copy(png.GetAddr(), subHandle_data->src.streamPtr.ToLE(), png.GetSize())) {
|
||||
cellPngDec->Error("cellPngDecDecodeData() failed (I)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memmove(Memory + png.GetAddr(), Memory + subHandle_data->src.streamPtr.ToLE(), png.GetSize());
|
||||
break;
|
||||
|
||||
case se32(CELL_PNGDEC_FILE):
|
||||
@ -253,20 +240,12 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
{
|
||||
const int dstOffset = i * bytesPerLine;
|
||||
const int srcOffset = width * nComponents * (flip ? height - i - 1 : i);
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize))
|
||||
{
|
||||
cellPngDec->Error("cellPngDecDecodeData() failed (II)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, &image.get()[srcOffset], linesize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Memory.CopyFromReal(data.GetAddr(), image.get(), image_size))
|
||||
{
|
||||
cellPngDec->Error("cellPngDecDecodeData() failed (III)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr(), image.get(), image_size);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -291,11 +270,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
output[j + 2] = image.get()[srcOffset + j + 1];
|
||||
output[j + 3] = image.get()[srcOffset + j + 2];
|
||||
}
|
||||
if (!Memory.CopyFromReal(data.GetAddr() + dstOffset, output, linesize))
|
||||
{
|
||||
cellPngDec->Error("cellPngDecDecodeData() failed (IV)");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + data.GetAddr() + dstOffset, output, linesize);
|
||||
}
|
||||
free(output);
|
||||
}
|
||||
@ -336,7 +311,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
||||
int cellPngDecExtDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam,
|
||||
mem_ptr_t<CellPngDecDataOutInfo> dataOutInfo, mem_ptr_t<CellPngDecCbCtrlDisp> cbCtrlDisp, mem_ptr_t<CellPngDecDispParam> dispParam)
|
||||
{
|
||||
cellPngDec->Warning("cellPngDecExtDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x, cbCtrlDisp_addr=0x%x, dispParam=0x%x",
|
||||
cellPngDec->Warning("cellPngDecExtDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x, cbCtrlDisp_addr=0x%x, dispParam=0x%x)",
|
||||
mainHandle, subHandle, data.GetAddr(), dataCtrlParam.GetAddr(), dataOutInfo.GetAddr(), cbCtrlDisp.GetAddr(), dispParam.GetAddr());
|
||||
|
||||
if (cbCtrlDisp.GetAddr()) cellPngDec->Warning("*** cbCtrlDisp->cbCtrlDispFunc_addr=0x%x", (u32)cbCtrlDisp->cbCtrlDispFunc_addr);
|
||||
@ -346,8 +321,8 @@ int cellPngDecExtDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, cons
|
||||
|
||||
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPngDecInParam> inParam, mem_ptr_t<CellPngDecOutParam> outParam)
|
||||
{
|
||||
if (!inParam.IsGood() || !outParam.IsGood())
|
||||
return CELL_PNGDEC_ERROR_ARG;
|
||||
cellPngDec->Warning("cellPngDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
|
||||
mainHandle, subHandle, inParam.GetAddr(), outParam.GetAddr());
|
||||
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec->CheckId(subHandle, subHandle_data))
|
||||
|
@ -640,7 +640,7 @@ int cellRescInit(mem_ptr_t<CellRescInitConfig> initConfig)
|
||||
return CELL_RESC_ERROR_REINITIALIZED;
|
||||
}
|
||||
|
||||
if (!initConfig.IsGood() || InternalVersion(initConfig.GetAddr()) == -1 || !CheckInitConfig(initConfig))
|
||||
if (InternalVersion(initConfig.GetAddr()) == -1 || !CheckInitConfig(initConfig))
|
||||
{
|
||||
cellResc->Error("cellRescInit : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
@ -687,12 +687,6 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t buffer
|
||||
{
|
||||
cellResc->Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.GetAddr());
|
||||
|
||||
if (!bufferMode.IsGood())
|
||||
{
|
||||
cellResc->Error("cellRescVideoOutResolutionId2RescBufferMode : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
switch (resolutionId)
|
||||
{
|
||||
case CELL_VIDEO_OUT_RESOLUTION_1080:
|
||||
@ -725,12 +719,6 @@ int cellRescSetDsts(u32 dstsMode, mem_ptr_t<CellRescDsts> dsts)
|
||||
return CELL_RESC_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if (!dsts.IsGood())
|
||||
{
|
||||
cellResc->Error("cellRescSetDst : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) && (dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080))
|
||||
{
|
||||
cellResc->Error("cellRescSetDsts : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
@ -958,17 +946,17 @@ int cellRescGetBufferSize(mem32_t colorBuffers, mem32_t vertexArray, mem32_t fra
|
||||
fragmentUcodeSize = 0x300;
|
||||
}
|
||||
|
||||
if (colorBuffers.IsGood())
|
||||
if (colorBuffers.GetAddr())
|
||||
{
|
||||
colorBuffers = colorBuffersSize;
|
||||
}
|
||||
|
||||
if (vertexArray.IsGood())
|
||||
if (vertexArray.GetAddr())
|
||||
{
|
||||
vertexArray = vertexArraySize;
|
||||
}
|
||||
|
||||
if (fragmentShader.IsGood())
|
||||
if (fragmentShader.GetAddr())
|
||||
{
|
||||
fragmentShader = fragmentUcodeSize;
|
||||
}
|
||||
@ -1001,12 +989,6 @@ int cellRescGcmSurface2RescSrc(mem_ptr_t<CellGcmSurface> gcmSurface, mem_ptr_t<C
|
||||
{
|
||||
cellResc->Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)", gcmSurface.GetAddr(), rescSrc.GetAddr());
|
||||
|
||||
if (!gcmSurface.IsGood() || !rescSrc.IsGood())
|
||||
{
|
||||
cellResc->Error("cellRescGcmSurface2RescSrc : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
u8 textureFormat = GcmSurfaceFormat2GcmTextureFormat(gcmSurface->colorFormat, gcmSurface->type);
|
||||
s32 xW = 1, xH = 1;
|
||||
|
||||
@ -1044,7 +1026,7 @@ int cellRescSetSrc(s32 idx, mem_ptr_t<CellRescSrc> src)
|
||||
return CELL_RESC_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if(idx < 0 || SRC_BUFFER_NUM <= idx || !src.IsGood())
|
||||
if(idx < 0 || SRC_BUFFER_NUM <= idx)
|
||||
{
|
||||
cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
@ -1125,12 +1107,6 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t
|
||||
return CELL_RESC_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
if(!colorBuffers.IsGood() || !vertexArray.IsGood() || !fragmentShader.IsGood())
|
||||
{
|
||||
cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ARGUMENT");
|
||||
return CELL_RESC_ERROR_BAD_ARGUMENT;
|
||||
}
|
||||
|
||||
if(colorBuffers.GetAddr() % COLOR_BUFFER_ALIGNMENT || vertexArray.GetAddr() % VERTEX_BUFFER_ALIGNMENT || fragmentShader.GetAddr() % FRAGMENT_SHADER_ALIGNMENT)
|
||||
{
|
||||
cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ALIGNMENT");
|
||||
@ -1169,11 +1145,6 @@ void cellRescSetFlipHandler(u32 handler_addr)
|
||||
{
|
||||
cellResc->Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler_addr);
|
||||
|
||||
if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
|
||||
{
|
||||
cellResc->Error("cellRescSetFlipHandler(handler_addr=%d): invalid address", handler_addr);
|
||||
}
|
||||
|
||||
Emu.GetGSManager().GetRender().m_flip_handler.SetAddr(handler_addr);
|
||||
}
|
||||
|
||||
@ -1214,11 +1185,6 @@ void cellRescSetVBlankHandler(u32 handler_addr)
|
||||
{
|
||||
cellResc->Warning("cellRescSetVBlankHandler(handler_addr=0x%x)", handler_addr);
|
||||
|
||||
if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
|
||||
{
|
||||
cellResc->Error("cellRescSetVBlankHandler(handler_addr=%d): invalid address", handler_addr);
|
||||
}
|
||||
|
||||
Emu.GetGSManager().GetRender().m_vblank_handler.SetAddr(handler_addr);
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,6 @@ int cellRtcGetCurrentTick(mem_ptr_t<CellRtcTick> pTick)
|
||||
{
|
||||
cellRtc->Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.GetAddr());
|
||||
|
||||
if (!pTick.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime unow = rDateTime::UNow();
|
||||
pTick->tick = unow.GetTicks();
|
||||
return CELL_OK;
|
||||
@ -38,9 +35,6 @@ int cellRtcGetCurrentClock(mem_ptr_t<CellRtcDateTime> pClock, s32 iTimeZone)
|
||||
{
|
||||
cellRtc->Log("cellRtcGetCurrentClock(pClock=0x%x, time_zone=%d)", pClock.GetAddr(), iTimeZone);
|
||||
|
||||
if (!pClock.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime unow = rDateTime::UNow();
|
||||
|
||||
// Add time_zone as offset in minutes.
|
||||
@ -62,9 +56,6 @@ int cellRtcGetCurrentClockLocalTime(mem_ptr_t<CellRtcDateTime> pClock)
|
||||
{
|
||||
cellRtc->Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.GetAddr());
|
||||
|
||||
if (!pClock.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime unow = rDateTime::UNow();
|
||||
|
||||
pClock->year = unow.GetYear(rDateTime::TZ::Local);
|
||||
@ -82,9 +73,6 @@ int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32
|
||||
{
|
||||
cellRtc->Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone);
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Add time_zone as offset in minutes.
|
||||
rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0);
|
||||
|
||||
@ -103,9 +91,6 @@ int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> p
|
||||
{
|
||||
cellRtc->Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr());
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Get date from ticks.
|
||||
rDateTime date = rDateTime((time_t)pUtc->tick);
|
||||
|
||||
@ -120,9 +105,6 @@ int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32
|
||||
{
|
||||
cellRtc->Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone);
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Add time_zone as offset in minutes.
|
||||
rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0);
|
||||
|
||||
@ -141,9 +123,6 @@ int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> p
|
||||
{
|
||||
cellRtc->Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr());
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Get date from ticks.
|
||||
rDateTime date = rDateTime((time_t) pUtc->tick);
|
||||
|
||||
@ -158,9 +137,6 @@ int cellRtcParseDateTime(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr)
|
||||
{
|
||||
cellRtc->Log("cellRtcParseDateTime(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr);
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Get date from formatted string.
|
||||
rDateTime date;
|
||||
const std::string& format = Memory.ReadString(pszDateTime_addr);
|
||||
@ -175,9 +151,6 @@ int cellRtcParseRfc3339(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr)
|
||||
{
|
||||
cellRtc->Log("cellRtcParseRfc3339(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr);
|
||||
|
||||
if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Get date from RFC3339 formatted string.
|
||||
rDateTime date;
|
||||
const std::string& format = Memory.ReadString(pszDateTime_addr);
|
||||
@ -192,9 +165,6 @@ int cellRtcGetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> pTic
|
||||
{
|
||||
cellRtc->Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr());
|
||||
|
||||
if (!pTime.IsGood() || !pTick.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime datetime = rDateTime(pTime->day, (rDateTime::Month)pTime->month.ToLE(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000));
|
||||
pTick->tick = datetime.GetTicks();
|
||||
|
||||
@ -205,9 +175,6 @@ int cellRtcSetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> pTic
|
||||
{
|
||||
cellRtc->Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr());
|
||||
|
||||
if (!pTime.IsGood() || !pTick.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick->tick);
|
||||
|
||||
pTime->year = date.GetYear(rDateTime::TZ::UTC);
|
||||
@ -225,9 +192,6 @@ int cellRtcTickAddTicks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddTicks(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
pTick0->tick = pTick1->tick + lAdd;
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -236,9 +200,6 @@ int cellRtcTickAddMicroseconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcT
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddMicroseconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000);
|
||||
date.Add(microseconds);
|
||||
@ -250,9 +211,6 @@ int cellRtcTickAddMicroseconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcT
|
||||
int cellRtcTickAddSeconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s64 lAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddSeconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0);
|
||||
@ -266,9 +224,6 @@ int cellRtcTickAddMinutes(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick>
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddMinutes(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0);
|
||||
date.Add(minutes);
|
||||
@ -280,9 +235,6 @@ int cellRtcTickAddMinutes(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick>
|
||||
int cellRtcTickAddHours(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddHours(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0);
|
||||
@ -295,9 +247,6 @@ int cellRtcTickAddHours(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
|
||||
int cellRtcTickAddDays(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddDays(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rDateSpan days = rDateSpan(0, 0, 0, iAdd);
|
||||
@ -310,9 +259,6 @@ int cellRtcTickAddDays(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTi
|
||||
int cellRtcTickAddWeeks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddWeeks(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rDateSpan weeks = rDateSpan(0, 0, iAdd, 0);
|
||||
@ -325,9 +271,6 @@ int cellRtcTickAddWeeks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
|
||||
int cellRtcTickAddMonths(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddMonths(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rDateSpan months = rDateSpan(0, iAdd, 0, 0);
|
||||
@ -340,9 +283,6 @@ int cellRtcTickAddMonths(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> p
|
||||
int cellRtcTickAddYears(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd)
|
||||
{
|
||||
cellRtc->Log("cellRtcTickAddYears(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd);
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date = rDateTime((time_t)pTick1->tick);
|
||||
rDateSpan years = rDateSpan(iAdd, 0, 0, 0);
|
||||
@ -356,9 +296,6 @@ int cellRtcConvertUtcToLocalTime(mem_ptr_t<CellRtcTick> pUtc, mem_ptr_t<CellRtcT
|
||||
{
|
||||
cellRtc->Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.GetAddr(), pLocalTime.GetAddr());
|
||||
|
||||
if (!pUtc.IsGood() || !pLocalTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime time = rDateTime((time_t)pUtc->tick);
|
||||
rDateTime local_time = time.FromUTC(false);
|
||||
pLocalTime->tick = local_time.GetTicks();
|
||||
@ -369,9 +306,6 @@ int cellRtcConvertLocalTimeToUtc(mem_ptr_t<CellRtcTick> pLocalTime, mem_ptr_t<Ce
|
||||
{
|
||||
cellRtc->Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.GetAddr(), pUtc.GetAddr());
|
||||
|
||||
if (!pLocalTime.IsGood() || !pUtc.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime time = rDateTime((time_t)pLocalTime->tick);
|
||||
rDateTime utc_time = time.ToUTC(false);
|
||||
pUtc->tick = utc_time.GetTicks();
|
||||
@ -382,9 +316,6 @@ int cellRtcGetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem32_t puiDosTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.GetAddr(), puiDosTime.GetAddr());
|
||||
|
||||
if (!pDateTime.IsGood() || !puiDosTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Convert to DOS time.
|
||||
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
|
||||
puiDosTime = date_time.GetAsDOS();
|
||||
@ -396,9 +327,6 @@ int cellRtcGetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t piTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.GetAddr(), piTime.GetAddr());
|
||||
|
||||
if (!pDateTime.IsGood() || !piTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Convert to POSIX time_t.
|
||||
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
|
||||
piTime = convertToUNIXTime(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
|
||||
@ -411,9 +339,6 @@ int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t pulWin
|
||||
{
|
||||
cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.GetAddr(), pulWin32FileTime.GetAddr());
|
||||
|
||||
if (!pDateTime.IsGood() || !pulWin32FileTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
// Convert to WIN32 FILETIME.
|
||||
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
|
||||
pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
|
||||
@ -425,9 +350,6 @@ int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t pulWin
|
||||
int cellRtcSetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, u32 uiDosTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcSetDosTime(pDateTime=0x%x, uiDosTime=0x%x)", pDateTime.GetAddr(), uiDosTime);
|
||||
|
||||
if (!pDateTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date_time;
|
||||
rDateTime dos_time = date_time.SetFromDOS(uiDosTime);
|
||||
@ -446,9 +368,6 @@ int cellRtcSetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, u32 uiDosTime)
|
||||
int cellRtcSetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, u64 iTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcSetTime_t(pDateTime=0x%x, iTime=0x%llx)", pDateTime.GetAddr(), iTime);
|
||||
|
||||
if (!pDateTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date_time = rDateTime((time_t)iTime);
|
||||
|
||||
@ -466,9 +385,6 @@ int cellRtcSetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, u64 iTime)
|
||||
int cellRtcSetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, u64 ulWin32FileTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcSetWin32FileTime(pDateTime=0x%x, ulWin32FileTime=0x%llx)", pDateTime, ulWin32FileTime);
|
||||
|
||||
if (!pDateTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
rDateTime date_time = rDateTime((time_t)ulWin32FileTime);
|
||||
|
||||
@ -511,9 +427,6 @@ int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day)
|
||||
int cellRtcCheckValid(mem_ptr_t<CellRtcDateTime> pTime)
|
||||
{
|
||||
cellRtc->Log("cellRtcCheckValid(pTime=0x%x)", pTime.GetAddr());
|
||||
|
||||
if (!pTime.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
if ((pTime->year < 1) || (pTime->year > 9999)) return CELL_RTC_ERROR_INVALID_YEAR;
|
||||
else if ((pTime->month < 1) || (pTime->month > 12)) return CELL_RTC_ERROR_INVALID_MONTH;
|
||||
@ -529,9 +442,6 @@ int cellRtcCompareTick(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTi
|
||||
{
|
||||
cellRtc->Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.GetAddr(), pTick1.GetAddr());
|
||||
|
||||
if (!pTick0.IsGood() || !pTick1.IsGood())
|
||||
return CELL_RTC_ERROR_INVALID_POINTER;
|
||||
|
||||
if (pTick0->tick < pTick1->tick) return -1;
|
||||
else if (pTick0->tick > pTick1->tick) return 1;
|
||||
else return CELL_OK;
|
||||
|
@ -21,12 +21,6 @@ int cellSpursInitialize(mem_ptr_t<CellSpurs> spurs, int nSpus, int spuPriority,
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
SPURSManagerAttribute *attr = new SPURSManagerAttribute(nSpus, spuPriority, ppuPriority, exitIfNoWork);
|
||||
spurs->spurs = new SPURSManager(attr);
|
||||
|
||||
@ -43,12 +37,6 @@ int cellSpursFinalize(mem_ptr_t<CellSpurs> spurs)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursFinalize : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
spurs->spurs->Finalize();
|
||||
|
||||
return CELL_OK;
|
||||
@ -64,12 +52,6 @@ int cellSpursInitializeWithAttribute(mem_ptr_t<CellSpurs> spurs, const mem_ptr_t
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursInitializeWithAttribute : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
spurs->spurs = new SPURSManager(attr->attr);
|
||||
|
||||
return CELL_OK;
|
||||
@ -85,12 +67,6 @@ int cellSpursInitializeWithAttribute2(mem_ptr_t<CellSpurs2> spurs, const mem_ptr
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
spurs->spurs = new SPURSManager(attr->attr);
|
||||
|
||||
return CELL_OK;
|
||||
@ -106,12 +82,6 @@ int _cellSpursAttributeInitialize(mem_ptr_t<CellSpursAttribute> attr, int nSpus,
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("_cellSpursAttributeInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
attr->attr = new SPURSManagerAttribute(nSpus, spuPriority, ppuPriority, exitIfNoWork);
|
||||
|
||||
return CELL_OK;
|
||||
@ -127,12 +97,6 @@ int cellSpursAttributeSetMemoryContainerForSpuThread(mem_ptr_t<CellSpursAttribut
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeSetMemoryContainerForSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
attr->attr->_setMemoryContainerForSpuThread(container);
|
||||
|
||||
return CELL_OK;
|
||||
@ -148,12 +112,6 @@ int cellSpursAttributeSetNamePrefix(mem_ptr_t<CellSpursAttribute> attr, const me
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood() || !prefix.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (size > CELL_SPURS_NAME_MAX_LENGTH)
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_INVAL");
|
||||
@ -175,12 +133,6 @@ int cellSpursAttributeEnableSpuPrintfIfAvailable(mem_ptr_t<CellSpursAttribute> a
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeEnableSpuPrintfIfAvailable : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -194,12 +146,6 @@ int cellSpursAttributeSetSpuThreadGroupType(mem_ptr_t<CellSpursAttribute> attr,
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeSetSpuThreadGroupType : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
attr->attr->_setSpuThreadGroupType(type);
|
||||
|
||||
return CELL_OK;
|
||||
@ -216,12 +162,6 @@ int cellSpursAttributeEnableSystemWorkload(mem_ptr_t<CellSpursAttribute> attr, c
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!attr.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
for (int i = 0; i < CELL_SPURS_MAX_SPU; i++)
|
||||
{
|
||||
if (priority[i] != 1 || maxSpu == 0)
|
||||
@ -243,12 +183,6 @@ int cellSpursGetSpuThreadGroupId(mem_ptr_t<CellSpurs> spurs, mem32_t group)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || group.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursGetSpuThreadGroupId : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -262,12 +196,6 @@ int cellSpursGetNumSpuThread(mem_ptr_t<CellSpurs> spurs, mem32_t nThreads)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || nThreads.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursGetNumSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -281,12 +209,6 @@ int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !thread.IsGood() || nThreads.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -300,12 +222,6 @@ int cellSpursSetMaxContention(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 ma
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursSetMaxContention : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -319,12 +235,6 @@ int cellSpursSetPriorities(mem_ptr_t<CellSpurs> spurs, u32 workloadId, const u8
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursSetPriorities : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -338,12 +248,6 @@ int cellSpursSetPriority(mem_ptr_t<CellSpurs> spurs, u32 workloadId, u32 spuId,
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursSetPriority : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -357,12 +261,6 @@ int cellSpursSetPreemptionVictimHints(mem_ptr_t<CellSpurs> spurs, const bool isP
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursSetPreemptionVictimHints : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -376,12 +274,6 @@ int cellSpursAttachLv2EventQueue(mem_ptr_t<CellSpurs> spurs, u32 queue, mem8_t p
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !port.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursAttachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
spurs->spurs->AttachLv2EventQueue(queue, port, isDynamic);
|
||||
|
||||
return CELL_OK;
|
||||
@ -397,12 +289,6 @@ int cellSpursDetachLv2EventQueue(mem_ptr_t<CellSpurs> spurs, u8 port)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursDetachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
spurs->spurs->DetachLv2EventQueue(port);
|
||||
|
||||
return CELL_OK;
|
||||
@ -418,12 +304,6 @@ int cellSpursEnableExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, bool flag)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEnableExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -437,12 +317,6 @@ int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs, mem_func
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || eaHandler.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursSetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -456,12 +330,6 @@ int cellSpursUnsetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursUnsetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -475,12 +343,6 @@ int cellSpursGetInfo(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursInfo> info)
|
||||
return CELL_SPURS_CORE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !info.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursGetInfo : CELL_SPURS_CORE_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -494,12 +356,6 @@ int _cellSpursEventFlagInitialize(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpur
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if ((!spurs.IsGood() && !taskset.IsGood()) || !eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
eventFlag->eventFlag = new SPURSManagerEventFlag(flagClearMode, flagDirection);
|
||||
|
||||
return CELL_OK;
|
||||
@ -515,12 +371,6 @@ int cellSpursEventFlagAttachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFla
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagAttachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -534,12 +384,6 @@ int cellSpursEventFlagDetachLv2EventQueue(mem_ptr_t<CellSpursEventFlag> eventFla
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagDetachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -553,12 +397,6 @@ int cellSpursEventFlagWait(mem_ptr_t<CellSpursEventFlag> eventFlag, mem16_t mask
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood() || !mask.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagWait : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -572,12 +410,6 @@ int cellSpursEventFlagClear(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagClear : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -591,12 +423,6 @@ int cellSpursEventFlagSet(mem_ptr_t<CellSpursEventFlag> eventFlag, u16 bits)
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagSet : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -610,12 +436,6 @@ int cellSpursEventFlagTryWait(mem_ptr_t<CellSpursEventFlag> eventFlag, mem16_t m
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -629,12 +449,6 @@ int cellSpursEventFlagGetDirection(mem_ptr_t<CellSpursEventFlag> eventFlag, mem3
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood() || !direction.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagGetDirection : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
direction = eventFlag->eventFlag->_getDirection();
|
||||
|
||||
return CELL_OK;
|
||||
@ -650,12 +464,6 @@ int cellSpursEventFlagGetClearMode(mem_ptr_t<CellSpursEventFlag> eventFlag, mem3
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood() || !clear_mode.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagGetClearMode : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
clear_mode = eventFlag->eventFlag->_getClearMode();
|
||||
|
||||
return CELL_OK;
|
||||
@ -671,12 +479,6 @@ int cellSpursEventFlagGetTasksetAddress(mem_ptr_t<CellSpursEventFlag> eventFlag,
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!eventFlag.IsGood() || !taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -704,12 +506,6 @@ int cellSpursLFQueueAttachLv2EventQueue()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueDetachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSpursLFQueuePopBody()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
@ -722,166 +518,6 @@ int cellSpursLFQueueGetTasksetAddress()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueGetEntrySize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
int cellSyncLFQueueSize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueClear()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
int _cellSyncLFQueueCompletePushPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPopPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueuePeek()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueueSize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueuePop()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePushPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueAttachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueuePush()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueueTryPeek()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPushPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueueTryPush()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPopPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePopPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueDetachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueueClear()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncQueueTryPop()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueInitialize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetSignalAddress()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueuePushBody()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueGetDirection()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueDepth()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueuePopBody()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPushPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePopPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSpursQueueInitialize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
@ -906,6 +542,48 @@ int cellSpursQueueAttachLv2EventQueue()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueDetachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueGetTasksetAddress()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueClear()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueDepth()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueGetEntrySize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueSize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursQueueGetDirection()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSpursCreateJobChainWithAttribute()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSpurs);
|
||||
@ -952,12 +630,6 @@ int cellSpursCreateTaskset(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursTaskse
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!spurs.IsGood() || !taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
SPURSManagerTasksetAttribute *tattr = new SPURSManagerTasksetAttribute(args, priority, maxContention);
|
||||
taskset->taskset = new SPURSManagerTaskset(taskset.GetAddr(), tattr);
|
||||
|
||||
@ -974,12 +646,6 @@ int cellSpursJoinTaskset(mem_ptr_t<CellSpursTaskset> taskset)
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursJoinTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -993,12 +659,6 @@ int cellSpursGetTasksetId(mem_ptr_t<CellSpursTaskset> taskset, mem32_t workloadI
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!taskset.IsGood() || !workloadId.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursGetTasksetId : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -1012,12 +672,6 @@ int cellSpursShutdownTaskset(mem_ptr_t<CellSpursTaskset> taskset)
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursShutdownTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -1034,12 +688,6 @@ int cellSpursCreateTask(mem_ptr_t<CellSpursTaskset> taskset, mem32_t taskID, mem
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -1053,12 +701,6 @@ int _cellSpursSendSignal(mem_ptr_t<CellSpursTaskset> taskset, u32 taskID)
|
||||
return CELL_SPURS_TASK_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (!taskset.IsGood())
|
||||
{
|
||||
cellSpurs->Error("_cellSpursSendSignal : CELL_SPURS_TASK_ERROR_NULL_POINTER");
|
||||
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -1357,45 +999,25 @@ void cellSpurs_init()
|
||||
cellSpurs->AddFunc(0xd5d0b256, cellSpursJobGuardNotify);
|
||||
cellSpurs->AddFunc(0x00af2519, cellSpursJobGuardReset);
|
||||
|
||||
// Queue/LFQueue
|
||||
// LFQueue
|
||||
cellSpurs->AddFunc(0x011ee38b, _cellSpursLFQueueInitialize);
|
||||
cellSpurs->AddFunc(0x8a85674d, _cellSpursLFQueuePushBody);
|
||||
cellSpurs->AddFunc(0x1656d49f, cellSpursLFQueueAttachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0x73e06f91, cellSpursLFQueueDetachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0x35dae22b, _cellSpursLFQueuePopBody);
|
||||
cellSpurs->AddFunc(0xb792ca1a, cellSpursLFQueueGetTasksetAddress);
|
||||
|
||||
// Queue
|
||||
cellSpurs->AddFunc(0x082bfb09, _cellSpursQueueInitialize);
|
||||
cellSpurs->AddFunc(0x91066667, cellSpursQueuePopBody);
|
||||
cellSpurs->AddFunc(0x92cff6ed, cellSpursQueuePushBody);
|
||||
cellSpurs->AddFunc(0xe5443be7, cellSpursQueueAttachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0x039d70b7, cellSpursQueueDetachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0x35dae22b, _cellSpursLFQueuePopBody);
|
||||
cellSpurs->AddFunc(0xb792ca1a, cellSpursLFQueueGetTasksetAddress);
|
||||
cellSpurs->AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize);
|
||||
cellSpurs->AddFunc(0x167ea63e, cellSyncLFQueueSize);
|
||||
cellSpurs->AddFunc(0x2af0c515, cellSyncLFQueueClear);
|
||||
cellSpurs->AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2);
|
||||
cellSpurs->AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2);
|
||||
cellSpurs->AddFunc(0x48154c9b, cellSyncQueuePeek);
|
||||
cellSpurs->AddFunc(0x4da349b2, cellSyncQueueSize);
|
||||
cellSpurs->AddFunc(0x4da6d7e0, cellSyncQueuePop);
|
||||
cellSpurs->AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer);
|
||||
cellSpurs->AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0x5ae841e5, cellSyncQueuePush);
|
||||
cellSpurs->AddFunc(0x68af923c, cellSyncQueueTryPeek);
|
||||
cellSpurs->AddFunc(0x6bb4ef9d,_cellSyncLFQueueGetPushPointer2);
|
||||
cellSpurs->AddFunc(0x705985cd, cellSyncQueueTryPush);
|
||||
cellSpurs->AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer);
|
||||
cellSpurs->AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2);
|
||||
cellSpurs->AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue);
|
||||
cellSpurs->AddFunc(0xa5362e73, cellSyncQueueClear);
|
||||
cellSpurs->AddFunc(0xa58df87f, cellSyncQueueTryPop);
|
||||
cellSpurs->AddFunc(0xaa355278, cellSyncLFQueueInitialize);
|
||||
cellSpurs->AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress);
|
||||
cellSpurs->AddFunc(0xba5961ca, _cellSyncLFQueuePushBody);
|
||||
cellSpurs->AddFunc(0xd59aa307, cellSyncLFQueueGetDirection);
|
||||
cellSpurs->AddFunc(0xe18c273c, cellSyncLFQueueDepth);
|
||||
cellSpurs->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
|
||||
cellSpurs->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
|
||||
cellSpurs->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
|
||||
|
||||
cellSpurs->AddFunc(0x2093252b, cellSpursQueueGetTasksetAddress);
|
||||
cellSpurs->AddFunc(0x247414d0, cellSpursQueueClear);
|
||||
cellSpurs->AddFunc(0x35f02287, cellSpursQueueDepth);
|
||||
cellSpurs->AddFunc(0x369fe03d, cellSpursQueueGetEntrySize);
|
||||
cellSpurs->AddFunc(0x54876603, cellSpursQueueSize);
|
||||
cellSpurs->AddFunc(0xec68442c, cellSpursQueueGetDirection);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ s32 cellSyncBarrierInitialize(mem_ptr_t<CellSyncBarrier> barrier, u16 total_coun
|
||||
|
||||
s32 cellSyncBarrierNotify(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
{
|
||||
cellSync->Todo("cellSyncBarrierNotify(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
cellSync->Log("cellSyncBarrierNotify(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
|
||||
if (!barrier)
|
||||
{
|
||||
@ -170,13 +170,42 @@ s32 cellSyncBarrierNotify(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// prx: sync, extract m_value, repeat if < 0, increase, compare with second s16, set sign bit if equal, insert it back
|
||||
InterlockedCompareExchange(&barrier->m_data(), 0, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = barrier->m_data();
|
||||
CellSyncBarrier new_barrier;
|
||||
new_barrier.m_data() = old_data;
|
||||
|
||||
s16 value = (s16)new_barrier.m_value;
|
||||
if (value < 0)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "cellSyncBarrierNotify(barrier_addr=0x%x) aborted", barrier.GetAddr());
|
||||
return CELL_OK;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
value++;
|
||||
if (value == (s16)new_barrier.m_count)
|
||||
{
|
||||
value |= 0x8000;
|
||||
}
|
||||
new_barrier.m_value = value;
|
||||
if (InterlockedCompareExchange(&barrier->m_data(), new_barrier.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSyncBarrierTryNotify(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
{
|
||||
cellSync->Todo("cellSyncBarrierTryNotify(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
cellSync->Log("cellSyncBarrierTryNotify(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
|
||||
if (!barrier)
|
||||
{
|
||||
@ -187,13 +216,37 @@ s32 cellSyncBarrierTryNotify(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
InterlockedCompareExchange(&barrier->m_data(), 0, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = barrier->m_data();
|
||||
CellSyncBarrier new_barrier;
|
||||
new_barrier.m_data() = old_data;
|
||||
|
||||
s16 value = (s16)new_barrier.m_value;
|
||||
if (value >= 0)
|
||||
{
|
||||
value++;
|
||||
if (value == (s16)new_barrier.m_count)
|
||||
{
|
||||
value |= 0x8000;
|
||||
}
|
||||
new_barrier.m_value = value;
|
||||
if (InterlockedCompareExchange(&barrier->m_data(), new_barrier.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InterlockedCompareExchange(&barrier->m_data(), new_barrier.m_data(), old_data) == old_data) return CELL_SYNC_ERROR_BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSyncBarrierWait(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
{
|
||||
cellSync->Todo("cellSyncBarrierWait(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
cellSync->Log("cellSyncBarrierWait(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
|
||||
if (!barrier)
|
||||
{
|
||||
@ -204,13 +257,42 @@ s32 cellSyncBarrierWait(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// prx: sync, extract m_value (repeat if >= 0), decrease it, set 0 if == 0x8000, insert it back
|
||||
InterlockedCompareExchange(&barrier->m_data(), 0, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = barrier->m_data();
|
||||
CellSyncBarrier new_barrier;
|
||||
new_barrier.m_data() = old_data;
|
||||
|
||||
s16 value = (s16)new_barrier.m_value;
|
||||
if (value >= 0)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "cellSyncBarrierWait(barrier_addr=0x%x) aborted", barrier.GetAddr());
|
||||
return CELL_OK;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
value--;
|
||||
if (value == (s16)0x8000)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
new_barrier.m_value = value;
|
||||
if (InterlockedCompareExchange(&barrier->m_data(), new_barrier.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSyncBarrierTryWait(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
{
|
||||
cellSync->Todo("cellSyncBarrierTryWait(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
cellSync->Log("cellSyncBarrierTryWait(barrier_addr=0x%x)", barrier.GetAddr());
|
||||
|
||||
if (!barrier)
|
||||
{
|
||||
@ -221,7 +303,29 @@ s32 cellSyncBarrierTryWait(mem_ptr_t<CellSyncBarrier> barrier)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
InterlockedCompareExchange(&barrier->m_data(), 0, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = barrier->m_data();
|
||||
CellSyncBarrier new_barrier;
|
||||
new_barrier.m_data() = old_data;
|
||||
|
||||
s16 value = (s16)new_barrier.m_value;
|
||||
if (value >= 0)
|
||||
{
|
||||
return CELL_SYNC_ERROR_BUSY;
|
||||
}
|
||||
|
||||
value--;
|
||||
if (value == (s16)0x8000)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
new_barrier.m_value = value;
|
||||
if (InterlockedCompareExchange(&barrier->m_data(), new_barrier.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -309,7 +413,7 @@ s32 cellSyncRwmRead(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
|
||||
|
||||
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);
|
||||
cellSync->Log("cellSyncRwmTryRead(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
|
||||
|
||||
if (!rwm || !buffer_addr)
|
||||
{
|
||||
@ -320,13 +424,44 @@ s32 cellSyncRwmTryRead(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = rwm->m_data();
|
||||
CellSyncRwm new_rwm;
|
||||
new_rwm.m_data() = old_data;
|
||||
|
||||
if (new_rwm.m_writers.ToBE())
|
||||
{
|
||||
return CELL_SYNC_ERROR_BUSY;
|
||||
}
|
||||
|
||||
new_rwm.m_readers++;
|
||||
if (InterlockedCompareExchange(&rwm->m_data(), new_rwm.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
memcpy(Memory + buffer_addr, Memory + (u64)rwm->m_addr, (u32)rwm->m_size);
|
||||
|
||||
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 cellSyncRwmWrite(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
|
||||
{
|
||||
cellSync->Todo("cellSyncRwmWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
|
||||
cellSync->Log("cellSyncRwmWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
|
||||
|
||||
if (!rwm || !buffer_addr)
|
||||
{
|
||||
@ -337,13 +472,51 @@ s32 cellSyncRwmWrite(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// prx: atomically compare second u16 (m_writers) with 0, repeat if not 0, set 1, 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("cellSyncRwmWrite(rwm_addr=0x%x) aborted (I)", rwm.GetAddr());
|
||||
return CELL_OK;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
new_rwm.m_writers = 1;
|
||||
if (InterlockedCompareExchange(&rwm->m_data(), new_rwm.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
// prx: wait until m_readers == 0
|
||||
while (rwm->m_readers.ToBE())
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
cellSync->Warning("cellSyncRwmWrite(rwm_addr=0x%x) aborted (II)", rwm.GetAddr());
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// prx: copy data from buffer_addr
|
||||
memcpy(Memory + (u64)rwm->m_addr, Memory + buffer_addr, (u32)rwm->m_size);
|
||||
|
||||
// prx: sync and zeroize m_readers and m_writers
|
||||
InterlockedCompareExchange(&rwm->m_data(), 0, 0);
|
||||
rwm->m_data() = 0;
|
||||
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);
|
||||
cellSync->Log("cellSyncRwmTryWrite(rwm_addr=0x%x, buffer_addr=0x%x)", rwm.GetAddr(), buffer_addr);
|
||||
|
||||
if (!rwm || !buffer_addr)
|
||||
{
|
||||
@ -354,7 +527,15 @@ s32 cellSyncRwmTryWrite(mem_ptr_t<CellSyncRwm> rwm, u32 buffer_addr)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// prx: compare m_readers | m_writers with 0, return busy if not zero, set m_writers to 1
|
||||
if (InterlockedCompareExchange(&rwm->m_data(), se32(1), 0) != 0) return CELL_SYNC_ERROR_BUSY;
|
||||
|
||||
// prx: copy data from buffer_addr
|
||||
memcpy(Memory + (u64)rwm->m_addr, Memory + buffer_addr, (u32)rwm->m_size);
|
||||
|
||||
// prx: sync and zeroize m_readers and m_writers
|
||||
InterlockedCompareExchange(&rwm->m_data(), 0, 0);
|
||||
rwm->m_data() = 0;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -636,15 +817,115 @@ s32 cellSyncQueueTryPop(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
|
||||
|
||||
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);
|
||||
cellSync->Log("cellSyncQueuePeek(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("cellSyncQueuePeek(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)))
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
cellSync->Warning("cellSyncQueuePeek(queue_addr=0x%x) aborted", queue.GetAddr());
|
||||
return CELL_OK;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
new_queue.m_v1 = 0x1000000 | v1;
|
||||
position = ((v1 & 0xffffff) + depth - (v2 & 0xffffff)) % depth;
|
||||
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 cellSyncQueueTryPeek(mem_ptr_t<CellSyncQueue> queue, u32 buffer_addr)
|
||||
{
|
||||
cellSync->Todo("cellSyncQueueTryPeek(queue_addr=0x%x, buffer_addr=0x%x)", queue.GetAddr(), buffer_addr);
|
||||
cellSync->Log("cellSyncQueueTryPeek(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("cellSyncQueueTryPeek(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;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -742,6 +1023,118 @@ s32 cellSyncQueueClear(mem_ptr_t<CellSyncQueue> queue)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueGetEntrySize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
int cellSyncLFQueueSize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueClear()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
int _cellSyncLFQueueCompletePushPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPopPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePushPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueAttachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPushPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPopPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePopPointer2()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueDetachLv2EventQueue()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueInitialize()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetSignalAddress()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueuePushBody()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueGetDirection()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncLFQueueDepth()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueuePopBody()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueGetPushPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int _cellSyncLFQueueCompletePopPointer()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellSync);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void cellSync_init()
|
||||
{
|
||||
cellSync->AddFunc(0xa9072dee, cellSyncMutexInitialize);
|
||||
@ -770,4 +1163,24 @@ void cellSync_init()
|
||||
cellSync->AddFunc(0x68af923c, cellSyncQueueTryPeek);
|
||||
cellSync->AddFunc(0x4da349b2, cellSyncQueueSize);
|
||||
cellSync->AddFunc(0xa5362e73, cellSyncQueueClear);
|
||||
|
||||
cellSync->AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize);
|
||||
cellSync->AddFunc(0x167ea63e, cellSyncLFQueueSize);
|
||||
cellSync->AddFunc(0x2af0c515, cellSyncLFQueueClear);
|
||||
cellSync->AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2);
|
||||
cellSync->AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2);
|
||||
cellSync->AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer);
|
||||
cellSync->AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue);
|
||||
cellSync->AddFunc(0x6bb4ef9d, _cellSyncLFQueueGetPushPointer2);
|
||||
cellSync->AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer);
|
||||
cellSync->AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2);
|
||||
cellSync->AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue);
|
||||
cellSync->AddFunc(0xaa355278, cellSyncLFQueueInitialize);
|
||||
cellSync->AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress);
|
||||
cellSync->AddFunc(0xba5961ca, _cellSyncLFQueuePushBody);
|
||||
cellSync->AddFunc(0xd59aa307, cellSyncLFQueueGetDirection);
|
||||
cellSync->AddFunc(0xe18c273c, cellSyncLFQueueDepth);
|
||||
cellSync->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody);
|
||||
cellSync->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer);
|
||||
cellSync->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer);
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong size");
|
||||
|
||||
struct CellSyncBarrier
|
||||
{
|
||||
be_t<u16> m_value;
|
||||
be_t<u16> m_count;
|
||||
be_t<s16> m_value;
|
||||
be_t<s16> m_count;
|
||||
|
||||
volatile u32& m_data()
|
||||
{
|
||||
@ -68,7 +68,7 @@ struct CellSyncRwm
|
||||
};
|
||||
};
|
||||
|
||||
static_assert(sizeof(CellSyncRwm) == 16, "CellSyncBarrier: wrong size");
|
||||
static_assert(sizeof(CellSyncRwm) == 16, "CellSyncRwm: wrong size");
|
||||
|
||||
struct CellSyncQueue
|
||||
{
|
||||
|
@ -25,11 +25,6 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value)
|
||||
{
|
||||
cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
if(!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch(id)
|
||||
{
|
||||
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG:
|
||||
@ -118,9 +113,6 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> buf, u32 bufsize)
|
||||
{
|
||||
cellSysutil->Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.GetAddr(), bufsize);
|
||||
|
||||
if (!buf.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
memset(buf, 0, bufsize);
|
||||
|
||||
switch(id)
|
||||
@ -184,9 +176,6 @@ int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution
|
||||
cellSysutil->Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)",
|
||||
resolutionId, resolution.GetAddr());
|
||||
|
||||
if (!resolution.IsGood())
|
||||
return CELL_VIDEO_OUT_ERROR_ILLEGAL_PARAMETER;
|
||||
|
||||
u32 num = ResolutionIdToNum(resolutionId);
|
||||
if(!num)
|
||||
return CELL_EINVAL;
|
||||
@ -202,11 +191,6 @@ s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 wa
|
||||
cellSysutil->Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)",
|
||||
videoOut, config_addr, option_addr, waitForEvent);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration)))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
CellVideoOutConfiguration& config = (CellVideoOutConfiguration&)Memory[config_addr];
|
||||
|
||||
switch(videoOut)
|
||||
@ -243,8 +227,6 @@ int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr)
|
||||
cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
||||
videoOut, config_addr, option_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT;
|
||||
|
||||
CellVideoOutConfiguration config = {};
|
||||
|
||||
switch(videoOut)
|
||||
@ -502,11 +484,6 @@ int cellAudioOutConfigure(u32 audioOut, mem_ptr_t<CellAudioOutConfiguration> con
|
||||
cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, (!)waitForEvent=%d)",
|
||||
audioOut, config.GetAddr(), option.GetAddr(), waitForEvent);
|
||||
|
||||
if (!config.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch(audioOut)
|
||||
{
|
||||
case CELL_AUDIO_OUT_PRIMARY:
|
||||
@ -536,8 +513,6 @@ int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr)
|
||||
cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)",
|
||||
audioOut, config_addr, option_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT;
|
||||
|
||||
CellAudioOutConfiguration config = {};
|
||||
|
||||
switch(audioOut)
|
||||
@ -653,6 +628,8 @@ typedef struct{
|
||||
|
||||
int cellSysCacheClear(void)
|
||||
{
|
||||
cellSysutil->Warning("cellSysCacheClear()");
|
||||
|
||||
//if some software expects CELL_SYSCACHE_ERROR_NOTMOUNTED we need to check whether
|
||||
//it was mounted before, for that we would need to save the state which I don't know
|
||||
//where to put
|
||||
@ -680,6 +657,8 @@ int cellSysCacheClear(void)
|
||||
|
||||
int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param)
|
||||
{
|
||||
cellSysutil->Warning("cellSysCacheMount(param_addr=0x%x)", param.GetAddr());
|
||||
|
||||
//TODO: implement
|
||||
char id[CELL_SYSCACHE_ID_SIZE];
|
||||
strncpy(id, param->cacheId, CELL_SYSCACHE_ID_SIZE);
|
||||
@ -695,9 +674,6 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_
|
||||
cellSysutil->Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)",
|
||||
version, dirName_addr, errDialog, funcStat, container);
|
||||
|
||||
if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood())
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
|
||||
std::string dirName = Memory.ReadString(dirName_addr);
|
||||
if (dirName.size() != 9)
|
||||
return CELL_HDDGAME_ERROR_PARAM;
|
||||
@ -830,6 +806,8 @@ int cellSysutilGetBgmPlaybackStatus2(mem_ptr_t<CellSysutilBgmPlaybackStatus2> st
|
||||
|
||||
int cellWebBrowserEstimate2(mem8_ptr_t _config, mem32_ptr_t memSize)
|
||||
{
|
||||
cellSysutil->Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", _config.GetAddr(), memSize.GetAddr());
|
||||
|
||||
// TODO: When cellWebBrowser stuff is implemented, change this to some real
|
||||
// needed memory buffer size.
|
||||
*memSize = 1024 * 1024 * 1; // 1 MB
|
||||
|
@ -146,7 +146,7 @@ void setSaveDataFixed(std::vector<SaveDataEntry>& saveEntries, mem_ptr_t<CellSav
|
||||
saveEntries.push_back(entry);
|
||||
}
|
||||
|
||||
if (fixedSet->newIcon.IsGood())
|
||||
if (fixedSet->newIcon.GetAddr())
|
||||
{
|
||||
saveEntries[0].iconBuf = Memory.VirtualToRealAddr(fixedSet->newIcon->iconBuf_addr);
|
||||
saveEntries[0].iconBufSize = fixedSet->newIcon->iconBufSize;
|
||||
@ -295,9 +295,6 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
cellSysutil->Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataListGet> listGet;
|
||||
MemoryAllocator<CellSaveDataListSet> listSet;
|
||||
@ -340,11 +337,9 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
LOG_ERROR(HLE, "cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
if (!listSet->fixedList.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum);
|
||||
if (listSet->newData.IsGood())
|
||||
if (listSet->newData.GetAddr())
|
||||
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr());
|
||||
if (saveEntries.size() == 0) {
|
||||
LOG_WARNING(HLE, "cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error
|
||||
@ -363,7 +358,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
LOG_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); // TODO: This *is* wrong
|
||||
*/
|
||||
|
||||
@ -380,9 +375,6 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
cellSysutil->Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataListGet> listGet;
|
||||
MemoryAllocator<CellSaveDataListSet> listSet;
|
||||
@ -425,11 +417,9 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
LOG_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
if (!listSet->fixedList.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
setSaveDataList(saveEntries, (u32)listSet->fixedList.GetAddr(), listSet->fixedListNum);
|
||||
if (listSet->newData.IsGood())
|
||||
if (listSet->newData.GetAddr())
|
||||
addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr());
|
||||
if (saveEntries.size() == 0) {
|
||||
LOG_WARNING(HLE, "cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error
|
||||
@ -448,7 +438,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
|
||||
LOG_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
// TODO: Write PARAM.SFO file
|
||||
*/
|
||||
|
||||
@ -465,9 +455,6 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
|
||||
cellSysutil->Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setList.IsGood() || !setBuf.IsGood() || !funcFixed.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataListGet> listGet;
|
||||
MemoryAllocator<CellSaveDataFixedSet> fixedSet;
|
||||
@ -520,7 +507,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
|
||||
LOG_ERROR(HLE, "cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
// TODO: Write PARAM.SFO file
|
||||
*/
|
||||
|
||||
@ -537,9 +524,6 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
|
||||
cellSysutil->Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setList.IsGood() || !setBuf.IsGood() || !funcFixed.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataListGet> listGet;
|
||||
MemoryAllocator<CellSaveDataFixedSet> fixedSet;
|
||||
@ -592,7 +576,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
|
||||
LOG_ERROR(HLE, "cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
// TODO: Write PARAM.SFO file
|
||||
*/
|
||||
|
||||
@ -609,9 +593,6 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
|
||||
cellSysutil->Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataStatGet> statGet;
|
||||
MemoryAllocator<CellSaveDataStatSet> statSet;
|
||||
@ -648,7 +629,7 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
|
||||
LOG_ERROR(HLE, "cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
// TODO: Write PARAM.SFO file
|
||||
*/
|
||||
|
||||
@ -662,12 +643,9 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
|
||||
mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
|
||||
u32 container, u32 userdata_addr)
|
||||
{
|
||||
cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)",
|
||||
version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
|
||||
|
||||
if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
|
||||
return CELL_SAVEDATA_ERROR_PARAM;
|
||||
|
||||
MemoryAllocator<CellSaveDataCBResult> result;
|
||||
MemoryAllocator<CellSaveDataStatGet> statGet;
|
||||
MemoryAllocator<CellSaveDataStatSet> statSet;
|
||||
@ -701,7 +679,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_
|
||||
LOG_ERROR(HLE, "cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
|
||||
return CELL_SAVEDATA_ERROR_CBRESULT;
|
||||
}
|
||||
/*if (statSet->setParam.IsGood())
|
||||
/*if (statSet->setParam.GetAddr())
|
||||
// TODO: Write PARAM.SFO file
|
||||
*/
|
||||
|
||||
|
@ -14,8 +14,6 @@ int cellUserInfoGetStat(u32 id, mem_ptr_t<CellUserInfoUserStat> stat)
|
||||
{
|
||||
cellUserInfo->Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.GetAddr());
|
||||
|
||||
if (!stat.IsGood())
|
||||
return CELL_USERINFO_ERROR_PARAM;
|
||||
if (id > CELL_USERINFO_USER_MAX)
|
||||
return CELL_USERINFO_ERROR_NOUSER;
|
||||
|
||||
@ -64,14 +62,14 @@ int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> listBuf
|
||||
listNum.GetAddr(), listBuf.GetAddr(), currentUserId.GetAddr());
|
||||
|
||||
// If only listNum is NULL, an error will be returned
|
||||
if (listBuf.IsGood() && !listNum.IsGood())
|
||||
if (listBuf.GetAddr() && !listNum.GetAddr())
|
||||
return CELL_USERINFO_ERROR_PARAM;
|
||||
if (listNum.IsGood())
|
||||
if (listNum.GetAddr())
|
||||
listNum = 1;
|
||||
if (listBuf.IsGood())
|
||||
if (listBuf.GetAddr())
|
||||
listBuf->userId[0] = 1;
|
||||
|
||||
if (currentUserId.IsGood())
|
||||
if (currentUserId.GetAddr())
|
||||
currentUserId = 1;
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -49,12 +49,7 @@ next:
|
||||
break;
|
||||
case vdecDecodeAu:
|
||||
{
|
||||
if (!Memory.CopyToReal(buf, vdec.reader.addr, vdec.reader.size))
|
||||
{
|
||||
LOG_ERROR(HLE, "vdecRead(): data reading failed (reader.size=0x%x)", vdec.reader.size);
|
||||
Emu.Pause();
|
||||
return 0;
|
||||
}
|
||||
memcpy(buf, Memory + vdec.reader.addr, vdec.reader.size);
|
||||
|
||||
buf += vdec.reader.size;
|
||||
buf_size -= vdec.reader.size;
|
||||
@ -89,14 +84,10 @@ next:
|
||||
{
|
||||
return res;
|
||||
}
|
||||
else if (!Memory.CopyToReal(buf, vdec.reader.addr, buf_size))
|
||||
{
|
||||
LOG_ERROR(HLE, "vdecRead(): data reading failed (buf_size=0x%x)", buf_size);
|
||||
Emu.Pause();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(buf, Memory + vdec.reader.addr, buf_size);
|
||||
|
||||
vdec.reader.addr += buf_size;
|
||||
vdec.reader.size -= buf_size;
|
||||
return res + buf_size;
|
||||
@ -428,11 +419,6 @@ int cellVdecQueryAttr(const mem_ptr_t<CellVdecType> type, mem_ptr_t<CellVdecAttr
|
||||
{
|
||||
cellVdec->Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr);
|
||||
}
|
||||
|
||||
@ -440,11 +426,6 @@ int cellVdecQueryAttrEx(const mem_ptr_t<CellVdecTypeEx> type, mem_ptr_t<CellVdec
|
||||
{
|
||||
cellVdec->Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr);
|
||||
}
|
||||
|
||||
@ -453,16 +434,6 @@ int cellVdecOpen(const mem_ptr_t<CellVdecType> type, const mem_ptr_t<CellVdecRes
|
||||
cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
|
||||
type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(res->memAddr, res->memSize) || !Memory.IsGoodAddr(cb->cbFunc))
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
@ -473,16 +444,6 @@ int cellVdecOpenEx(const mem_ptr_t<CellVdecTypeEx> type, const mem_ptr_t<CellVde
|
||||
cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
|
||||
type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(res->memAddr, res->memSize) || !Memory.IsGoodAddr(cb->cbFunc))
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
|
||||
|
||||
return CELL_OK;
|
||||
@ -599,11 +560,6 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
|
||||
return CELL_VDEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!format.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (vdec->frames.IsEmpty())
|
||||
{
|
||||
return CELL_VDEC_ERROR_EMPTY;
|
||||
@ -613,11 +569,6 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
|
||||
{
|
||||
u32 buf_size = a128(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1));
|
||||
|
||||
if (!Memory.IsGoodAddr(out_addr, buf_size))
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR)
|
||||
{
|
||||
cellVdec->Todo("cellVdecGetPicture: unknown formatType(%d)", (u32)format->formatType);
|
||||
@ -636,26 +587,17 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
|
||||
|
||||
AVFrame& frame = *vf.data;
|
||||
|
||||
u8* buf = (u8*)malloc(buf_size);
|
||||
|
||||
// TODO: zero padding bytes
|
||||
|
||||
int err = av_image_copy_to_buffer(buf, buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1);
|
||||
int err = av_image_copy_to_buffer(Memory + out_addr, buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1);
|
||||
if (err < 0)
|
||||
{
|
||||
cellVdec->Error("cellVdecGetPicture: av_image_copy_to_buffer failed(%d)", err);
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
if (!Memory.CopyFromReal(out_addr, buf, buf_size))
|
||||
{
|
||||
cellVdec->Error("cellVdecGetPicture: data copying failed");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
av_frame_unref(vf.data);
|
||||
av_frame_free(&vf.data);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
@ -671,11 +613,6 @@ int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr)
|
||||
return CELL_VDEC_ERROR_ARG;
|
||||
}
|
||||
|
||||
if (!picItem_ptr.IsGood())
|
||||
{
|
||||
return CELL_VDEC_ERROR_FATAL;
|
||||
}
|
||||
|
||||
if (vdec->frames.IsEmpty())
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
|
||||
|
@ -19,9 +19,6 @@ int cellVpostQueryAttr(const mem_ptr_t<CellVpostCfgParam> cfgParam, mem_ptr_t<Ce
|
||||
{
|
||||
cellVpost->Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_Q_ARG_CFG_NULL;
|
||||
if (!attr.IsGood()) return CELL_VPOST_ERROR_Q_ARG_ATTR_NULL;
|
||||
|
||||
// TODO: check cfgParam and output values
|
||||
|
||||
attr->delay = 0;
|
||||
@ -46,10 +43,6 @@ int cellVpostOpen(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t<C
|
||||
cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
|
||||
cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL;
|
||||
if (!resource.IsGood()) return CELL_VPOST_ERROR_O_ARG_RSRC_NULL;
|
||||
if (!handle.IsGood()) return CELL_VPOST_ERROR_O_ARG_HDL_NULL;
|
||||
|
||||
// TODO: check values
|
||||
handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV));
|
||||
return CELL_OK;
|
||||
@ -60,10 +53,6 @@ int cellVpostOpenEx(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t
|
||||
cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
|
||||
cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr());
|
||||
|
||||
if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL;
|
||||
if (!resource.IsGood()) return CELL_VPOST_ERROR_O_ARG_RSRC_NULL;
|
||||
if (!handle.IsGood()) return CELL_VPOST_ERROR_O_ARG_HDL_NULL;
|
||||
|
||||
// TODO: check values
|
||||
handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV));
|
||||
return CELL_OK;
|
||||
@ -95,31 +84,11 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
return CELL_VPOST_ERROR_E_ARG_HDL_INVALID;
|
||||
}
|
||||
|
||||
if (!ctrlParam.IsGood())
|
||||
{
|
||||
return CELL_VPOST_ERROR_E_ARG_CTRL_INVALID;
|
||||
}
|
||||
|
||||
s32 w = ctrlParam->inWidth;
|
||||
u32 h = ctrlParam->inHeight;
|
||||
u32 ow = ctrlParam->outWidth;
|
||||
u32 oh = ctrlParam->outHeight;
|
||||
|
||||
if (!Memory.IsGoodAddr(inPicBuff_addr, w*h*3/2))
|
||||
{
|
||||
return CELL_VPOST_ERROR_E_ARG_INPICBUF_INVALID;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(outPicBuff_addr, ow*oh*4))
|
||||
{
|
||||
return CELL_VPOST_ERROR_E_ARG_OUTPICBUF_INVALID;
|
||||
}
|
||||
|
||||
if (!picInfo.IsGood())
|
||||
{
|
||||
return CELL_VPOST_ERROR_E_ARG_PICINFO_NULL;
|
||||
}
|
||||
|
||||
ctrlParam->inWindow; // ignored
|
||||
if (ctrlParam->inWindow.x) LOG_WARNING(HLE, "*** inWindow.x = %d", (u32)ctrlParam->inWindow.x);
|
||||
if (ctrlParam->inWindow.y) LOG_WARNING(HLE, "*** inWindow.y = %d", (u32)ctrlParam->inWindow.y);
|
||||
@ -159,29 +128,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
picInfo->reserved2 = 0;
|
||||
|
||||
u64 stamp0 = get_system_time();
|
||||
std::unique_ptr<u8[]> pY(new u8[w*h]); // color planes
|
||||
std::unique_ptr<u8[]> pU(new u8[w*h/4]);
|
||||
std::unique_ptr<u8[]> pV(new u8[w*h/4]);
|
||||
std::unique_ptr<u8[]> pA(new u8[w*h]);
|
||||
std::unique_ptr<u32[]> res(new u32[ow*oh*4]); // RGBA interleaved output
|
||||
|
||||
if (!Memory.CopyToReal(pY.get(), inPicBuff_addr, w*h))
|
||||
{
|
||||
cellVpost->Error("cellVpostExec: data copying failed(pY)");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
if (!Memory.CopyToReal(pU.get(), inPicBuff_addr + w*h, w*h/4))
|
||||
{
|
||||
cellVpost->Error("cellVpostExec: data copying failed(pU)");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
if (!Memory.CopyToReal(pV.get(), inPicBuff_addr + w*h + w*h/4, w*h/4))
|
||||
{
|
||||
cellVpost->Error("cellVpostExec: data copying failed(pV)");
|
||||
Emu.Pause();
|
||||
}
|
||||
|
||||
memset(pA.get(), (const u8)ctrlParam->outAlpha, w*h);
|
||||
|
||||
@ -191,22 +138,16 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
||||
|
||||
u64 stamp2 = get_system_time();
|
||||
|
||||
u8* in_data[4] = { pY.get(), pU.get(), pV.get(), pA.get() };
|
||||
u8* in_data[4] = { Memory.GetMemFromAddr(inPicBuff_addr), Memory.GetMemFromAddr(inPicBuff_addr + w*h), Memory.GetMemFromAddr(inPicBuff_addr + w*h + w*h / 4), pA.get() };
|
||||
int in_line[4] = { w, w/2, w/2, w };
|
||||
u8* out_data[4] = { (u8*)res.get(), NULL, NULL, NULL };
|
||||
u8* out_data[4] = { Memory.GetMemFromAddr(outPicBuff_addr), NULL, NULL, NULL };
|
||||
int out_line[4] = { static_cast<int>(ow*4), 0, 0, 0 };
|
||||
|
||||
sws_scale(sws, in_data, in_line, 0, h, out_data, out_line);
|
||||
|
||||
sws_freeContext(sws);
|
||||
|
||||
u64 stamp3 = get_system_time();
|
||||
|
||||
if (!Memory.CopyFromReal(outPicBuff_addr, res.get(), ow*oh*4))
|
||||
{
|
||||
cellVpost->Error("cellVpostExec: data copying failed(result)");
|
||||
Emu.Pause();
|
||||
}
|
||||
sws_freeContext(sws);
|
||||
|
||||
//ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)",
|
||||
//stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
|
||||
|
@ -146,11 +146,6 @@ int cellSSPlayerCreate(mem32_t handle, mem_ptr_t<CellSSPlayerConfig> config)
|
||||
libmixer->Warning("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)",
|
||||
handle.GetAddr(), config.GetAddr());
|
||||
|
||||
if (!config.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (config->outputMode != 0 || config->channels - 1 >= 2)
|
||||
{
|
||||
libmixer->Error("cellSSPlayerCreate(config.outputMode=%d, config.channels=%d): invalid parameters",
|
||||
@ -195,11 +190,6 @@ int cellSSPlayerSetWave(u32 handle, mem_ptr_t<CellSSPlayerWaveParam> waveInfo, m
|
||||
libmixer->Warning("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)",
|
||||
handle, waveInfo.GetAddr(), commonInfo.GetAddr());
|
||||
|
||||
if (!waveInfo.IsGood() || (commonInfo.GetAddr() && !commonInfo.IsGood()))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
|
||||
if (handle >= ssp.size() || !ssp[handle].m_created)
|
||||
@ -223,11 +213,6 @@ int cellSSPlayerPlay(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> info)
|
||||
{
|
||||
libmixer->Warning("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.GetAddr());
|
||||
|
||||
if (!info.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
|
||||
if (handle >= ssp.size() || !ssp[handle].m_created)
|
||||
@ -271,11 +256,6 @@ int cellSSPlayerSetParam(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> info)
|
||||
{
|
||||
libmixer->Warning("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.GetAddr());
|
||||
|
||||
if (!info.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(mixer_mutex);
|
||||
|
||||
if (handle >= ssp.size() || !ssp[handle].m_created)
|
||||
|
@ -120,8 +120,6 @@ int sceNpManagerGetStatus(mem32_t status)
|
||||
sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.GetAddr());
|
||||
|
||||
// TODO: Check if sceNpInit() was called, if not return SCE_NP_ERROR_NOT_INITIALIZED
|
||||
if (!status.IsGood())
|
||||
return SCE_NP_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
// TODO: Support different statuses
|
||||
status = SCE_NP_MANAGER_STATUS_OFFLINE;
|
||||
|
@ -96,8 +96,6 @@ int sceNpTrophyCreateContext(mem32_t context, mem_ptr_t<SceNpCommunicationId> co
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!context.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
if (options & (~(u64)1))
|
||||
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
|
||||
// TODO: There are other possible errors
|
||||
@ -135,8 +133,6 @@ int sceNpTrophyCreateHandle(mem32_t handle)
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!handle.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
// TODO: ?
|
||||
@ -144,15 +140,13 @@ int sceNpTrophyCreateHandle(mem32_t handle)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 arg_addr, u64 options)
|
||||
int sceNpTrophyRegisterContext(u32 context, u32 handle, mem_func_ptr_t<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options)
|
||||
{
|
||||
sceNpTrophy->Warning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)",
|
||||
context, handle, statusCb_addr, arg_addr, options);
|
||||
context, handle, statusCb.GetAddr(), arg_addr, options);
|
||||
|
||||
if (!(s_npTrophyInstance.m_bInitialized))
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!Memory.IsGoodAddr(statusCb_addr))
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
if (options & (~(u64)1))
|
||||
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
|
||||
if (context >= s_npTrophyInstance.contexts.size())
|
||||
@ -205,6 +199,8 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a
|
||||
ctxt.tropusr.reset(tropusr);
|
||||
|
||||
// TODO: Callbacks
|
||||
statusCb(context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg_addr);
|
||||
statusCb(context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg_addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -228,8 +224,6 @@ int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!reqspace.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
if (context >= s_npTrophyInstance.contexts.size())
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
// TODO: There are other possible errors
|
||||
@ -261,8 +255,6 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_t<SceNpTrophyGameDet
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!details.IsGood() || !data.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
std::string path;
|
||||
@ -321,8 +313,6 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t plati
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!platinumId.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
@ -354,8 +344,6 @@ int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, mem_ptr_t<SceNpTrop
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!flags.IsGood() || !count.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
@ -388,10 +376,8 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t<Sc
|
||||
|
||||
if (!s_npTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (!details.IsGood() || !data.IsGood())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
|
||||
std::string path;
|
||||
rXmlDocument doc;
|
||||
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
|
||||
|
@ -116,3 +116,22 @@ struct SceNpTrophyFlagArray
|
||||
{
|
||||
u32 flag_bits[SCE_NP_TROPHY_FLAG_SETSIZE >> SCE_NP_TROPHY_FLAG_BITS_SHIFT];
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SCE_NP_TROPHY_STATUS_UNKNOWN = 0,
|
||||
SCE_NP_TROPHY_STATUS_NOT_INSTALLED = 1,
|
||||
SCE_NP_TROPHY_STATUS_DATA_CORRUPT = 2,
|
||||
SCE_NP_TROPHY_STATUS_INSTALLED = 3,
|
||||
SCE_NP_TROPHY_STATUS_REQUIRES_UPDATE = 4,
|
||||
|
||||
SCE_NP_TROPHY_STATUS_PROCESSING_SETUP = 5,
|
||||
SCE_NP_TROPHY_STATUS_PROCESSING_PROGRESS = 6,
|
||||
SCE_NP_TROPHY_STATUS_PROCESSING_FINALIZE = 7,
|
||||
|
||||
SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE = 8,
|
||||
|
||||
SCE_NP_TROPHY_STATUS_CHANGES_DETECTED = 9,
|
||||
};
|
||||
|
||||
typedef s32 (*SceNpTrophyStatusCallback)(u32 context, u32 status, s32 completed, s32 total, u32 arg_addr);
|
||||
|
@ -105,11 +105,6 @@ int sys_spu_image_import(mem_ptr_t<sys_spu_image> img, u32 src, u32 type)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=0x%x)", img.GetAddr(), src, type);
|
||||
|
||||
if(!img.IsGood() || !Memory.IsGoodAddr(src))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
vfsStreamMemory f(src);
|
||||
u32 entry;
|
||||
u32 offset = LoadSpuImage(f, entry);
|
||||
@ -154,11 +149,7 @@ int sys_raw_spu_image_load(int id, mem_ptr_t<sys_spu_image> img)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.GetAddr());
|
||||
|
||||
if (!Memory.Copy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, (u32)img->segs_addr, 256 * 1024))
|
||||
{
|
||||
sysPrxForUser->Error("sys_raw_spu_image_load() failed");
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, Memory + (u32)img->segs_addr, 256 * 1024);
|
||||
Memory.Write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs, (u32)img->entry_point);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -117,10 +117,7 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
sys_fs->Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx) -> cellFsOpen()",
|
||||
path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
|
||||
|
||||
/*if (!fd.IsGood() || (!arg.IsGood() && size))
|
||||
return CELL_EFAULT;
|
||||
|
||||
if (flags != CELL_O_RDONLY)
|
||||
/*if (flags != CELL_O_RDONLY)
|
||||
return CELL_EINVAL;
|
||||
|
||||
std::string suffix = path.substr(path.length() - 5, 5);
|
||||
@ -198,11 +195,6 @@ int cellFsAioRead(mem_ptr_t<CellFsAio> aio, mem32_t aio_id, mem_func_ptr_t<void
|
||||
{
|
||||
sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr());
|
||||
|
||||
if (!aio.IsGood() || !aio_id.IsGood() || !func.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (!aio_init)
|
||||
{
|
||||
return CELL_ENXIO;
|
||||
|
@ -34,9 +34,9 @@ static func_caller* sc_table[kSyscallTableLength] =
|
||||
|
||||
null_func, null_func, null_func, null_func, null_func, null_func, //6-11 UNS
|
||||
|
||||
bind_func(sys_process_get_number_of_object), //12 (0x00B)
|
||||
bind_func(sys_process_get_id), //13 (0x00C)
|
||||
null_func,//bind_func(sys_process_is_spu_lock_line_reservation_address), //14 (0x00D)
|
||||
bind_func(sys_process_get_number_of_object), //12 (0x00C)
|
||||
bind_func(sys_process_get_id), //13 (0x00D)
|
||||
null_func,//bind_func(sys_process_is_spu_lock_line_reservation_address), //14 (0x00E)
|
||||
|
||||
null_func, null_func, null_func, //15-17 UNS
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "lv2/lv2Fs.h"
|
||||
#include "lv2/sys_cond.h"
|
||||
#include "lv2/sys_event.h"
|
||||
#include "lv2/sys_event_flag.h"
|
||||
#include "lv2/sys_interrupt.h"
|
||||
#include "lv2/sys_lwcond.h"
|
||||
#include "lv2/sys_lwmutex.h"
|
||||
@ -27,8 +28,6 @@
|
||||
#include "lv2/sys_tty.h"
|
||||
#include "lv2/sys_vm.h"
|
||||
|
||||
#include "Emu/Event.h"
|
||||
|
||||
#include "rpcs3/Ini.h"
|
||||
#include "LogBase.h"
|
||||
|
||||
|
@ -118,7 +118,7 @@ s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
}
|
||||
|
||||
fd = sys_fs->GetNewId(stream, IDFlag_File);
|
||||
LOG_WARNING(HLE, "\"%s\" opened: fd = %d", path.c_str(), fd.GetValue());
|
||||
LOG_NOTICE(HLE, "\"%s\" opened: fd = %d", path.c_str(), fd.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -130,12 +130,6 @@ s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (nread.GetAddr() && !nread.IsGood())
|
||||
{
|
||||
sys_fs->Error("cellFsRead(): bad nread_addr(0x%x)", nread.GetAddr());
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (nbytes != (u32)nbytes) return CELL_ENOMEM;
|
||||
|
||||
// TODO: checks
|
||||
@ -154,8 +148,6 @@ s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (nwrite.GetAddr() && !nwrite.IsGood()) return CELL_EFAULT;
|
||||
|
||||
if (nbytes != (u32)nbytes) return CELL_ENOMEM;
|
||||
|
||||
// TODO: checks
|
||||
@ -182,9 +174,6 @@ s32 cellFsOpendir(u32 path_addr, mem32_t fd)
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.c_str(), fd.GetAddr());
|
||||
|
||||
if(!Memory.IsGoodAddr(path_addr) || !fd.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
vfsDirBase* dir = Emu.GetVFS().OpenDir(path);
|
||||
if(!dir || !dir->IsOpened())
|
||||
{
|
||||
@ -203,8 +192,6 @@ s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
|
||||
vfsDirBase* directory;
|
||||
if(!sys_fs->CheckId(fd, directory))
|
||||
return CELL_ESRCH;
|
||||
if(!dir.IsGood() || !nread.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
const DirEntryInfo* info = directory->Read();
|
||||
if(info)
|
||||
@ -235,7 +222,7 @@ s32 cellFsClosedir(u32 fd)
|
||||
s32 cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
||||
{
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr());
|
||||
sys_fs->Warning("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr());
|
||||
|
||||
sb->st_mode =
|
||||
CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR |
|
||||
@ -320,6 +307,7 @@ s32 cellFsRename(u32 from_addr, u32 to_addr)
|
||||
{
|
||||
const std::string& ps3_from = Memory.ReadString(from_addr);
|
||||
const std::string& ps3_to = Memory.ReadString(to_addr);
|
||||
sys_fs->Log("cellFsRename(from='%s' (from_addr=0x%x), to='%s' (to_addr=0x%x))", ps3_from.c_str(), from_addr, ps3_to.c_str(), to_addr);
|
||||
|
||||
{
|
||||
vfsDir dir;
|
||||
@ -366,9 +354,6 @@ s32 cellFsUnlink(u32 path_addr)
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs->Warning("cellFsUnlink(path=\"%s\")", ps3_path.c_str());
|
||||
|
||||
if (ps3_path.empty())
|
||||
return CELL_EFAULT;
|
||||
|
||||
if (Emu.GetVFS().ExistsDir(ps3_path))
|
||||
return CELL_EISDIR;
|
||||
|
||||
@ -488,9 +473,6 @@ s32 cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
||||
sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
|
||||
ps3_path.c_str(), block_size.GetAddr(), block_count.GetAddr());
|
||||
|
||||
if (!Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
if (ps3_path.empty())
|
||||
return CELL_EINVAL;
|
||||
|
||||
@ -508,8 +490,6 @@ s32 cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u
|
||||
vfsDirBase* directory;
|
||||
if(!sys_fs->CheckId(fd, directory))
|
||||
return CELL_ESRCH;
|
||||
if(!entries.IsGood() || !data_count.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
const DirEntryInfo* info = directory->Read();
|
||||
if(info)
|
||||
@ -546,9 +526,6 @@ s32 cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if(!ringbuf.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
fs_config.m_ring_buffer = *ringbuf;
|
||||
|
||||
if(ringbuf->ringbuf_size < 0x40000000) // If the size is less than 1MB
|
||||
@ -584,9 +561,6 @@ s32 cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if(!ringbuf.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
*ringbuf = fs_config.m_ring_buffer;
|
||||
|
||||
sys_fs->Warning("*** fs stream config: block_size=0x%llx, copy=%d, ringbuf_size = 0x%llx, transfer_rate = 0x%llx",
|
||||
@ -650,8 +624,6 @@ s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (rsize.GetAddr() && !rsize.IsGood()) return CELL_EFAULT;
|
||||
|
||||
fs_config.m_regid += size;
|
||||
rsize = fs_config.m_regid;
|
||||
|
||||
@ -665,8 +637,6 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (!addr_addr.IsGood() && !size.IsGood()) return CELL_EFAULT;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -677,8 +647,6 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
if (!Memory.IsGoodAddr(addr_addr)) return CELL_EFAULT;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
@ -696,9 +664,6 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd,
|
||||
{
|
||||
sys_fs->Todo("cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr());
|
||||
|
||||
if (!func.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
vfsStream* file;
|
||||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
|
@ -14,11 +14,6 @@ s32 sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute>
|
||||
sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)",
|
||||
cond_id.GetAddr(), mutex_id, attr.GetAddr());
|
||||
|
||||
if (!cond_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
sys_cond.Error("Invalid pshared attribute(0x%x)", (u32)attr->pshared);
|
||||
|
@ -6,9 +6,7 @@
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/Cell/SPUThread.h"
|
||||
#include "Emu/Event.h"
|
||||
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_event.h"
|
||||
|
||||
SysCallBase sys_event("sys_event");
|
||||
@ -23,11 +21,6 @@ s32 sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> at
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!equeue_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
@ -114,16 +107,6 @@ s32 sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_ar
|
||||
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())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (size && !Memory.IsGoodAddr(event_array.GetAddr(), sizeof(sys_event_data) * size))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
EventQueue* eq;
|
||||
if (!Emu.GetIdManager().GetIDData(equeue_id, eq))
|
||||
{
|
||||
@ -163,11 +146,6 @@ s32 sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64
|
||||
sys_event.Log("sys_event_queue_receive(equeue_id=%d, event_addr=0x%x, timeout=%lld)",
|
||||
equeue_id, event.GetAddr(), timeout);
|
||||
|
||||
if (!event.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
EventQueue* eq;
|
||||
if (!Emu.GetIdManager().GetIDData(equeue_id, eq))
|
||||
{
|
||||
@ -252,11 +230,6 @@ s32 sys_event_port_create(mem32_t eport_id, int port_type, u64 name)
|
||||
sys_event.Warning("sys_event_port_create(eport_id_addr=0x%x, port_type=0x%x, name=0x%llx)",
|
||||
eport_id.GetAddr(), port_type, name);
|
||||
|
||||
if (!eport_id.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (port_type != SYS_EVENT_PORT_LOCAL)
|
||||
{
|
||||
sys_event.Error("sys_event_port_create: invalid port_type(0x%x)", port_type);
|
||||
@ -387,365 +360,4 @@ s32 sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
// sys_event_flag
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init)
|
||||
{
|
||||
sys_event.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
|
||||
eflag_id.GetAddr(), attr.GetAddr(), init);
|
||||
|
||||
if(!eflag_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): 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;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (attr->type.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_WAITER_SINGLE): break;
|
||||
case se32(SYS_SYNC_WAITER_MULTIPLE): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
eflag_id = sys_event.GetNewId(new EventFlag(init, (u32)attr->protocol, (int)attr->type));
|
||||
|
||||
sys_event.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_destroy(u32 eflag_id)
|
||||
{
|
||||
sys_event.Warning("sys_event_flag_destroy(eflag_id=%d)", eflag_id);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (ef->waiters.size()) // ???
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().RemoveID(eflag_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
|
||||
eflag_id, bitptn, mode, result.GetAddr(), timeout);
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.size() > 0)
|
||||
{
|
||||
return CELL_EPERM;
|
||||
}
|
||||
EventFlagWaiter rec;
|
||||
rec.bitptn = bitptn;
|
||||
rec.mode = mode;
|
||||
rec.tid = tid;
|
||||
ef->waiters.push_back(rec);
|
||||
|
||||
if (ef->check() == tid)
|
||||
{
|
||||
u64 flags = ef->flags;
|
||||
|
||||
ef->waiters.erase(ef->waiters.end() - 1);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
u32 counter = 0;
|
||||
const u32 max_counter = timeout ? (timeout / 1000) : ~0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (ef->signal.unlock(tid, tid) == SMR_OK)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() +i);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.unlock(tid, target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->signal.unlock(tid);
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
ef->signal.unlock(tid);
|
||||
return CELL_ECANCELED;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
||||
if (counter++ > max_counter)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
|
||||
eflag_id, bitptn, mode, result.GetAddr());
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
|
||||
((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
|
||||
{
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_set(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
ef->m_mutex.lock(tid);
|
||||
ef->flags |= bitptn;
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.lock(target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->m_mutex.unlock(tid);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_clear(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
ef->flags &= bitptn;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
std::vector<u32> tids;
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
tids.resize(ef->waiters.size());
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
tids[i] = ef->waiters[i].tid;
|
||||
}
|
||||
ef->waiters.clear();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tids.size(); i++)
|
||||
{
|
||||
ef->signal.lock(tids[i]);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (num.IsGood())
|
||||
{
|
||||
num = tids.size();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!num.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (!flags.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
flags = ef->flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
@ -1,77 +1,216 @@
|
||||
#pragma once
|
||||
#include "Emu/Event.h"
|
||||
|
||||
enum
|
||||
#include "sys_lwmutex.h"
|
||||
|
||||
#define FIX_SPUQ(x) ((u64)x | 0x5350555100000000ULL)
|
||||
// arbitrary code to prevent "special" zero value in key argument
|
||||
|
||||
enum EventQueueType
|
||||
{
|
||||
SYS_SYNC_WAITER_SINGLE = 0x10000,
|
||||
SYS_SYNC_WAITER_MULTIPLE = 0x20000,
|
||||
|
||||
SYS_EVENT_FLAG_WAIT_AND = 0x01,
|
||||
SYS_EVENT_FLAG_WAIT_OR = 0x02,
|
||||
|
||||
SYS_EVENT_FLAG_WAIT_CLEAR = 0x10,
|
||||
SYS_EVENT_FLAG_WAIT_CLEAR_ALL = 0x20,
|
||||
SYS_PPU_QUEUE = 1,
|
||||
SYS_SPU_QUEUE = 2,
|
||||
};
|
||||
|
||||
struct sys_event_flag_attr
|
||||
enum EventQueueDestroyMode
|
||||
{
|
||||
be_t<u32> protocol;
|
||||
be_t<u32> pshared;
|
||||
be_t<u64> ipc_key;
|
||||
be_t<int> flags;
|
||||
be_t<int> type;
|
||||
char name[8];
|
||||
// DEFAULT = 0,
|
||||
SYS_EVENT_QUEUE_DESTROY_FORCE = 1,
|
||||
};
|
||||
|
||||
struct EventFlagWaiter
|
||||
enum EventPortType
|
||||
{
|
||||
u32 tid;
|
||||
u32 mode;
|
||||
u64 bitptn;
|
||||
SYS_EVENT_PORT_LOCAL = 1,
|
||||
};
|
||||
|
||||
struct EventFlag
|
||||
enum EventSourceType
|
||||
{
|
||||
SMutex m_mutex;
|
||||
u64 flags;
|
||||
std::vector<EventFlagWaiter> waiters;
|
||||
SMutex signal;
|
||||
const u32 m_protocol;
|
||||
const int m_type;
|
||||
SYS_SPU_THREAD_EVENT_USER = 1,
|
||||
/* SYS_SPU_THREAD_EVENT_DMA = 2, */ // not supported
|
||||
};
|
||||
|
||||
EventFlag(u64 pattern, u32 protocol, int type)
|
||||
: flags(pattern)
|
||||
, m_protocol(protocol)
|
||||
, m_type(type)
|
||||
enum EventSourceKey : u64
|
||||
{
|
||||
SYS_SPU_THREAD_EVENT_USER_KEY = 0xFFFFFFFF53505501,
|
||||
/* SYS_SPU_THREAD_EVENT_DMA_KEY = 0xFFFFFFFF53505502, */
|
||||
};
|
||||
|
||||
struct sys_event_queue_attr
|
||||
{
|
||||
be_t<u32> protocol; // SYS_SYNC_PRIORITY or SYS_SYNC_FIFO
|
||||
be_t<int> type; // SYS_PPU_QUEUE or SYS_SPU_QUEUE
|
||||
union
|
||||
{
|
||||
char name[8];
|
||||
u64 name_u64;
|
||||
};
|
||||
};
|
||||
|
||||
struct sys_event_data
|
||||
{
|
||||
be_t<u64> source;
|
||||
be_t<u64> data1;
|
||||
be_t<u64> data2;
|
||||
be_t<u64> data3;
|
||||
};
|
||||
|
||||
struct EventQueue;
|
||||
|
||||
struct EventPort
|
||||
{
|
||||
u64 name; // generated or user-specified code that is passed to sys_event_data struct
|
||||
EventQueue* eq; // event queue this port has been connected to
|
||||
std::mutex m_mutex; // may be locked until the event sending is finished
|
||||
|
||||
EventPort(u64 name = 0)
|
||||
: eq(nullptr)
|
||||
, name(name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
u32 check()
|
||||
class EventRingBuffer
|
||||
{
|
||||
std::vector<sys_event_data> data;
|
||||
std::mutex m_mutex;
|
||||
u32 buf_pos;
|
||||
u32 buf_count;
|
||||
|
||||
public:
|
||||
const u32 size;
|
||||
|
||||
EventRingBuffer(u32 size)
|
||||
: size(size)
|
||||
, buf_pos(0)
|
||||
, buf_count(0)
|
||||
{
|
||||
SleepQueue sq; // TODO: implement without SleepQueue
|
||||
data.resize(size);
|
||||
}
|
||||
|
||||
u32 target = 0;
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
buf_count = 0;
|
||||
buf_pos = 0;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < waiters.size(); i++)
|
||||
bool push(u64 name, u64 d1, u64 d2, u64 d3)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (buf_count >= size) return false;
|
||||
|
||||
sys_event_data& ref = data[(buf_pos + buf_count++) % size];
|
||||
ref.source = name;
|
||||
ref.data1 = d1;
|
||||
ref.data2 = d2;
|
||||
ref.data3 = d3;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pop(sys_event_data& ref)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (!buf_count) return false;
|
||||
|
||||
sys_event_data& from = data[buf_pos];
|
||||
buf_pos = (buf_pos + 1) % size;
|
||||
buf_count--;
|
||||
ref.source = from.source;
|
||||
ref.data1 = from.data1;
|
||||
ref.data2 = from.data2;
|
||||
ref.data3 = from.data3;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 pop_all(sys_event_data* ptr, u32 max)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
u32 res = 0;
|
||||
while (buf_count && max)
|
||||
{
|
||||
if (((waiters[i].mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & waiters[i].bitptn) == waiters[i].bitptn) ||
|
||||
((waiters[i].mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & waiters[i].bitptn)))
|
||||
sys_event_data& from = data[buf_pos];
|
||||
ptr->source = from.source;
|
||||
ptr->data1 = from.data1;
|
||||
ptr->data2 = from.data2;
|
||||
ptr->data3 = from.data3;
|
||||
buf_pos = (buf_pos + 1) % size;
|
||||
buf_count--;
|
||||
max--;
|
||||
ptr++;
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
u32 count() const
|
||||
{
|
||||
return buf_count;
|
||||
}
|
||||
};
|
||||
|
||||
class EventPortList
|
||||
{
|
||||
std::vector<EventPort*> data;
|
||||
std::mutex m_mutex;
|
||||
|
||||
public:
|
||||
|
||||
void clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock2(data[i]->m_mutex);
|
||||
data[i]->eq = nullptr; // force all ports to disconnect
|
||||
}
|
||||
data.clear();
|
||||
}
|
||||
|
||||
void add(EventPort* port)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
data.push_back(port);
|
||||
}
|
||||
|
||||
void remove(EventPort* port)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_mutex);
|
||||
for (u32 i = 0; i < data.size(); i++)
|
||||
{
|
||||
if (data[i] == port)
|
||||
{
|
||||
if (m_protocol == SYS_SYNC_FIFO)
|
||||
{
|
||||
target = waiters[i].tid;
|
||||
break;
|
||||
}
|
||||
sq.list.push_back(waiters[i].tid);
|
||||
data.erase(data.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (m_protocol == SYS_SYNC_PRIORITY)
|
||||
{
|
||||
target = sq.pop_prio();
|
||||
}
|
||||
struct EventQueue
|
||||
{
|
||||
SleepQueue sq;
|
||||
EventPortList ports;
|
||||
EventRingBuffer events;
|
||||
SMutex owner;
|
||||
|
||||
return target;
|
||||
const union
|
||||
{
|
||||
u64 name_u64;
|
||||
char name[8];
|
||||
};
|
||||
const u32 protocol;
|
||||
const int type;
|
||||
const u64 key;
|
||||
|
||||
EventQueue(u32 protocol, int type, u64 name, u64 key, int size)
|
||||
: type(type)
|
||||
, protocol(protocol)
|
||||
, name_u64(name)
|
||||
, key(key)
|
||||
, events(size) // size: max event count this queue can hold
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
@ -87,12 +226,3 @@ s32 sys_event_port_destroy(u32 eport_id);
|
||||
s32 sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id);
|
||||
s32 sys_event_port_disconnect(u32 eport_id);
|
||||
s32 sys_event_port_send(u32 event_port_id, u64 data1, u64 data2, u64 data3);
|
||||
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init);
|
||||
s32 sys_event_flag_destroy(u32 eflag_id);
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout);
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result);
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num);
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags);
|
||||
|
329
rpcs3/Emu/SysCalls/lv2/sys_event_flag.cpp
Normal file
329
rpcs3/Emu/SysCalls/lv2/sys_event_flag.cpp
Normal file
@ -0,0 +1,329 @@
|
||||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
#include "sys_event_flag.h"
|
||||
|
||||
SysCallBase sys_event_flag("sys_event_flag");
|
||||
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init)
|
||||
{
|
||||
sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
|
||||
eflag_id.GetAddr(), attr.GetAddr(), init);
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_RETRY): sys_event_flag.Todo("sys_event_flag_create(): SYS_SYNC_RETRY"); break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event_flag.Todo("sys_event_flag_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (attr->type.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_WAITER_SINGLE): break;
|
||||
case se32(SYS_SYNC_WAITER_MULTIPLE): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
eflag_id = sys_event_flag.GetNewId(new EventFlag(init, (u32)attr->protocol, (int)attr->type));
|
||||
|
||||
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_destroy(u32 eflag_id)
|
||||
{
|
||||
sys_event_flag.Warning("sys_event_flag_destroy(eflag_id=%d)", eflag_id);
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (ef->waiters.size()) // ???
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().RemoveID(eflag_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
|
||||
eflag_id, bitptn, mode, result.GetAddr(), timeout);
|
||||
|
||||
if (result.GetAddr()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.size() > 0)
|
||||
{
|
||||
return CELL_EPERM;
|
||||
}
|
||||
EventFlagWaiter rec;
|
||||
rec.bitptn = bitptn;
|
||||
rec.mode = mode;
|
||||
rec.tid = tid;
|
||||
ef->waiters.push_back(rec);
|
||||
|
||||
if (ef->check() == tid)
|
||||
{
|
||||
u64 flags = ef->flags;
|
||||
|
||||
ef->waiters.erase(ef->waiters.end() - 1);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.GetAddr()) result = flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
|
||||
u32 counter = 0;
|
||||
const u32 max_counter = timeout ? (timeout / 1000) : ~0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (ef->signal.unlock(tid, tid) == SMR_OK)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.unlock(tid, target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->signal.unlock(tid);
|
||||
}
|
||||
|
||||
if (result.GetAddr()) result = flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ef->signal.unlock(tid);
|
||||
return CELL_ECANCELED;
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
|
||||
if (counter++ > max_counter)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
|
||||
eflag_id, bitptn, mode, result.GetAddr());
|
||||
|
||||
if (result.GetAddr()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
|
||||
((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
|
||||
{
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.GetAddr()) result = flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_set(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
ef->m_mutex.lock(tid);
|
||||
ef->flags |= bitptn;
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.lock(target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->m_mutex.unlock(tid);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_clear(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
ef->flags &= bitptn;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
std::vector<u32> tids;
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
tids.resize(ef->waiters.size());
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
tids[i] = ef->waiters[i].tid;
|
||||
}
|
||||
ef->waiters.clear();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tids.size(); i++)
|
||||
{
|
||||
ef->signal.lock(tids[i]);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (num.GetAddr()) num = tids.size();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
flags = ef->flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
84
rpcs3/Emu/SysCalls/lv2/sys_event_flag.h
Normal file
84
rpcs3/Emu/SysCalls/lv2/sys_event_flag.h
Normal file
@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_SYNC_WAITER_SINGLE = 0x10000,
|
||||
SYS_SYNC_WAITER_MULTIPLE = 0x20000,
|
||||
|
||||
SYS_EVENT_FLAG_WAIT_AND = 0x01,
|
||||
SYS_EVENT_FLAG_WAIT_OR = 0x02,
|
||||
|
||||
SYS_EVENT_FLAG_WAIT_CLEAR = 0x10,
|
||||
SYS_EVENT_FLAG_WAIT_CLEAR_ALL = 0x20,
|
||||
};
|
||||
|
||||
struct sys_event_flag_attr
|
||||
{
|
||||
be_t<u32> protocol;
|
||||
be_t<u32> pshared;
|
||||
be_t<u64> ipc_key;
|
||||
be_t<int> flags;
|
||||
be_t<int> type;
|
||||
char name[8];
|
||||
};
|
||||
|
||||
struct EventFlagWaiter
|
||||
{
|
||||
u32 tid;
|
||||
u32 mode;
|
||||
u64 bitptn;
|
||||
};
|
||||
|
||||
struct EventFlag
|
||||
{
|
||||
SMutex m_mutex;
|
||||
u64 flags;
|
||||
std::vector<EventFlagWaiter> waiters;
|
||||
SMutex signal;
|
||||
const u32 m_protocol;
|
||||
const int m_type;
|
||||
|
||||
EventFlag(u64 pattern, u32 protocol, int type)
|
||||
: flags(pattern)
|
||||
, m_protocol(protocol)
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
u32 check()
|
||||
{
|
||||
SleepQueue sq; // TODO: implement without SleepQueue
|
||||
|
||||
u32 target = 0;
|
||||
|
||||
for (u32 i = 0; i < waiters.size(); i++)
|
||||
{
|
||||
if (((waiters[i].mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & waiters[i].bitptn) == waiters[i].bitptn) ||
|
||||
((waiters[i].mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & waiters[i].bitptn)))
|
||||
{
|
||||
if (m_protocol == SYS_SYNC_FIFO)
|
||||
{
|
||||
target = waiters[i].tid;
|
||||
break;
|
||||
}
|
||||
sq.list.push_back(waiters[i].tid);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_protocol == SYS_SYNC_PRIORITY)
|
||||
{
|
||||
target = sq.pop_prio();
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
};
|
||||
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init);
|
||||
s32 sys_event_flag_destroy(u32 eflag_id);
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout);
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result);
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num);
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags);
|
@ -41,11 +41,6 @@ s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64
|
||||
{
|
||||
sc_int.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.GetAddr(), intrtag, intrthread, arg);
|
||||
|
||||
if (!ih.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
u32 id = intrtag & 0xff;
|
||||
u32 class_id = intrtag >> 8;
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
|
@ -14,31 +14,10 @@ s32 sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> l
|
||||
sys_lwcond.Log("sys_lwcond_create(lwcond_addr=0x%x, lwmutex_addr=0x%x, attr_addr=0x%x)",
|
||||
lwcond.GetAddr(), lwmutex.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!lwcond.IsGood() /*|| !lwmutex.IsGood()*/ || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
u32 id = sys_lwcond.GetNewId(new Lwcond(attr->name_u64));
|
||||
lwcond->lwmutex = lwmutex.GetAddr();
|
||||
lwcond->lwcond_queue = id;
|
||||
|
||||
if (lwmutex.IsGood())
|
||||
{
|
||||
if (lwmutex->attribute.ToBE() & se32(SYS_SYNC_RETRY))
|
||||
{
|
||||
sys_lwcond.Warning("Unsupported SYS_SYNC_RETRY lwmutex protocol");
|
||||
}
|
||||
if (lwmutex->attribute.ToBE() & se32(SYS_SYNC_RECURSIVE))
|
||||
{
|
||||
sys_lwcond.Warning("Recursive lwmutex(sq=%d)", (u32)lwmutex->sleep_queue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_lwcond.Warning("Invalid lwmutex address(0x%x)", lwmutex.GetAddr());
|
||||
}
|
||||
|
||||
sys_lwcond.Warning("*** lwcond created [%s] (lwmutex_addr=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), lwmutex.GetAddr(), (u32) lwcond->lwcond_queue);
|
||||
|
||||
@ -49,11 +28,6 @@ s32 sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Warning("sys_lwcond_destroy(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
if (!lwcond.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
u32 id = lwcond->lwcond_queue;
|
||||
|
||||
Lwcond* lw;
|
||||
@ -75,11 +49,6 @@ s32 sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
if (!lwcond.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Lwcond* lw;
|
||||
if (!Emu.GetIdManager().GetIDData((u32)lwcond->lwcond_queue, lw))
|
||||
{
|
||||
@ -106,11 +75,6 @@ s32 sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal_all(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
if (!lwcond.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Lwcond* lw;
|
||||
if (!Emu.GetIdManager().GetIDData((u32)lwcond->lwcond_queue, lw))
|
||||
{
|
||||
@ -137,11 +101,6 @@ s32 sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal_to(lwcond_addr=0x%x, ppu_thread_id=%d)", lwcond.GetAddr(), ppu_thread_id);
|
||||
|
||||
if (!lwcond.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Lwcond* lw;
|
||||
if (!Emu.GetIdManager().GetIDData((u32)lwcond->lwcond_queue, lw))
|
||||
{
|
||||
@ -176,11 +135,6 @@ s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_wait(lwcond_addr=0x%x, timeout=%lld)", lwcond.GetAddr(), timeout);
|
||||
|
||||
if (!lwcond.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Lwcond* lw;
|
||||
if (!Emu.GetIdManager().GetIDData((u32)lwcond->lwcond_queue, lw))
|
||||
{
|
||||
|
@ -13,8 +13,6 @@ s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
||||
sc_lwmutex.Log("sys_lwmutex_create(lwmutex_addr=0x%x, lwmutex_attr_addr=0x%x)",
|
||||
lwmutex.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!lwmutex.IsGood() || !attr.IsGood()) return CELL_EFAULT;
|
||||
|
||||
switch (attr->attr_recursive.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_RECURSIVE): break;
|
||||
@ -51,8 +49,6 @@ s32 sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Warning("sys_lwmutex_destroy(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
if (!lwmutex.IsGood()) return CELL_EFAULT;
|
||||
|
||||
u32 sq_id = lwmutex->sleep_queue;
|
||||
if (!Emu.GetIdManager().CheckID(sq_id)) return CELL_ESRCH;
|
||||
|
||||
@ -72,8 +68,6 @@ s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_lock(lwmutex_addr=0x%x, timeout=%lld)", lwmutex.GetAddr(), timeout);
|
||||
|
||||
if (!lwmutex.IsGood()) return CELL_EFAULT;
|
||||
|
||||
//ConLog.Write("*** lock mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
|
||||
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
|
||||
|
||||
@ -84,8 +78,6 @@ s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_trylock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
if (!lwmutex.IsGood()) return CELL_EFAULT;
|
||||
|
||||
return lwmutex->trylock(be_t<u32>::MakeFromLE(GetCurrentPPUThread().GetId()));
|
||||
}
|
||||
|
||||
@ -93,8 +85,6 @@ s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_unlock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
if (!lwmutex.IsGood()) return CELL_EFAULT;
|
||||
|
||||
//ConLog.Write("*** unlocking mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
|
||||
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
|
||||
|
||||
|
@ -82,7 +82,7 @@ s32 sys_memory_free(u32 start_addr)
|
||||
|
||||
// Release the allocated memory.
|
||||
if(!Memory.Free(start_addr))
|
||||
return CELL_EFAULT;
|
||||
return CELL_EINVAL;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
@ -91,9 +91,6 @@ s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
|
||||
|
||||
if (!attr.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// TODO: Implement per thread page attribute setting.
|
||||
attr->attribute = 0;
|
||||
attr->page_size = 0;
|
||||
@ -117,9 +114,6 @@ s32 sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
|
||||
|
||||
if (!cid.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
yield_size &= ~0xfffff; //round down to 1 MB granularity
|
||||
u64 addr = Memory.Alloc(yield_size, 0x100000); //1 MB alignment
|
||||
|
||||
|
@ -15,9 +15,6 @@ s32 sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_a
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_address(size=0x%x, flags=0x%llx, alignment=0x%x, alloc_addr=0x%x)",
|
||||
size, flags, alignment, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check for valid alignment.
|
||||
if(alignment > 0x80000000)
|
||||
return CELL_EALIGN;
|
||||
@ -61,9 +58,6 @@ s32 sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check page granularity.
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
@ -98,9 +92,6 @@ s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)",
|
||||
size, cid, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sys_mmapper.CheckId(cid, ct))
|
||||
@ -139,9 +130,6 @@ s32 sys_mmapper_change_address_access_right(u32 start_addr, u64 flags)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_change_address_access_right(start_addr=0x%x, flags=0x%llx)", start_addr, flags);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
@ -151,9 +139,6 @@ s32 sys_mmapper_free_address(u32 start_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_free_address(start_addr=0x%x)", start_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// Free the address.
|
||||
Memory.Free(start_addr);
|
||||
return CELL_OK;
|
||||
@ -199,9 +184,6 @@ s32 sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_
|
||||
sys_mmapper.Warning("sys_mmapper_search_and_map(start_addr=0x%x, mem_id=0x%x, flags=0x%llx, alloc_addr=0x%x)",
|
||||
start_addr, mem_id, flags, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sys_mmapper.CheckId(mem_id, info))
|
||||
@ -221,8 +203,7 @@ s32 sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the address is valid.
|
||||
if (!Memory.IsGoodAddr(addr) || !found)
|
||||
if (!found)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
@ -238,12 +219,6 @@ s32 sys_mmapper_unmap_memory(u32 start_addr, u32 mem_id_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_unmap_memory(start_addr=0x%x, mem_id_addr=0x%x)", start_addr, mem_id_addr);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
if (!Memory.IsGoodAddr(mem_id_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Write back the mem ID of the unmapped area.
|
||||
u32 mem_id = mmapper_info_map.find(start_addr)->first;
|
||||
Memory.Write32(mem_id_addr, mem_id);
|
||||
@ -255,9 +230,6 @@ s32 sys_mmapper_enable_page_fault_notification(u32 start_addr, u32 q_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_enable_page_fault_notification(start_addr=0x%x, q_id=0x%x)", start_addr, q_id);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -13,11 +13,6 @@ s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!mutex_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
|
@ -108,7 +108,6 @@ s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
|
||||
if(!thr) return CELL_ESRCH;
|
||||
if(!Memory.IsGoodAddr(prio_addr)) return CELL_EFAULT;
|
||||
|
||||
Memory.Write32(prio_addr, thr->GetPrio());
|
||||
|
||||
@ -119,8 +118,6 @@ s32 sys_ppu_thread_get_stack_information(u32 info_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(info_addr)) return CELL_EFAULT;
|
||||
|
||||
declCPU();
|
||||
|
||||
Memory.Write32(info_addr, CPU.GetStackAddr());
|
||||
@ -157,23 +154,10 @@ s32 sys_ppu_thread_restart(u64 thread_id)
|
||||
s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
{
|
||||
std::string threadname = "";
|
||||
if (Memory.IsGoodAddr(threadname_addr))
|
||||
{
|
||||
threadname = Memory.ReadString(threadname_addr);
|
||||
sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
|
||||
thread_id.GetAddr(), entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x)",
|
||||
thread_id.GetAddr(), entry, arg, prio, stacksize, flags, threadname_addr);
|
||||
if (threadname_addr != 0) return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (!Memory.IsGoodAddr(entry) || !thread_id.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
if (threadname_addr) threadname = Memory.ReadString(threadname_addr);
|
||||
|
||||
sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
|
||||
thread_id.GetAddr(), entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str());
|
||||
|
||||
bool is_joinable = false;
|
||||
bool is_interrupt = false;
|
||||
|
@ -12,6 +12,7 @@ sysProcessObjects_t procObjects;
|
||||
|
||||
s32 sys_process_getpid()
|
||||
{
|
||||
sc_p.Log("sys_process_getpid() -> 1");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -60,13 +61,13 @@ void sys_game_process_exitspawn(
|
||||
std::vector<std::string> env;
|
||||
|
||||
mem_ptr_t<u32> argvp(argv_addr);
|
||||
while (argvp.GetAddr() && argvp.IsGood() && *argvp)
|
||||
while (argvp.GetAddr() && *argvp)
|
||||
{
|
||||
argv.push_back(Memory.ReadString(Memory.Read32(argvp.GetAddr())));
|
||||
argvp++;
|
||||
}
|
||||
mem_ptr_t<u32> envp(envp_addr);
|
||||
while (envp.GetAddr() && envp.IsGood() && *envp)
|
||||
while (envp.GetAddr() && *envp)
|
||||
{
|
||||
env.push_back(Memory.ReadString(Memory.Read32(envp.GetAddr())));
|
||||
envp++;
|
||||
@ -108,13 +109,13 @@ void sys_game_process_exitspawn2(
|
||||
std::vector<std::string> env;
|
||||
|
||||
mem_ptr_t<u32> argvp(argv_addr);
|
||||
while (argvp.GetAddr() && argvp.IsGood() && *argvp)
|
||||
while (argvp.GetAddr() && *argvp)
|
||||
{
|
||||
argv.push_back(Memory.ReadString(Memory.Read32(argvp.GetAddr())));
|
||||
argvp++;
|
||||
}
|
||||
mem_ptr_t<u32> envp(envp_addr);
|
||||
while (envp.GetAddr() && envp.IsGood() && *envp)
|
||||
while (envp.GetAddr() && *envp)
|
||||
{
|
||||
env.push_back(Memory.ReadString(Memory.Read32(envp.GetAddr())));
|
||||
envp++;
|
||||
@ -137,9 +138,6 @@ s32 sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
||||
object, nump.GetAddr());
|
||||
|
||||
if (!nump.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
switch(object)
|
||||
{
|
||||
@ -234,9 +232,6 @@ s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
|
||||
|
||||
if (!version.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
version = 0x360001; // TODO
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -10,9 +10,6 @@ SysCallBase sys_prx("sys_prx");
|
||||
|
||||
s32 sys_prx_load_module(u32 path_addr, u64 flags, mem_ptr_t<sys_prx_load_module_option_t> pOpt)
|
||||
{
|
||||
if (!Memory.IsGoodAddr(path_addr))
|
||||
return CELL_PRX_ERROR_INVAL;
|
||||
|
||||
std::string path = Memory.ReadString(path_addr);
|
||||
sys_prx.Todo("sys_prx_load_module(path=\"%s\", flags=0x%llx, pOpt=0x%x)", path.c_str(), flags, pOpt.GetAddr());
|
||||
|
||||
@ -55,9 +52,6 @@ s32 sys_prx_start_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 fl
|
||||
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())
|
||||
return CELL_EINVAL;
|
||||
|
||||
sys_prx_t* prx;
|
||||
if (!Emu.GetIdManager().GetIDData(id, prx))
|
||||
return CELL_ESRCH;
|
||||
@ -73,9 +67,6 @@ s32 sys_prx_stop_module(s32 id, u32 args, u32 argp_addr, mem32_t modres, u64 fla
|
||||
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())
|
||||
return CELL_EINVAL;
|
||||
|
||||
sys_prx_t* prx;
|
||||
if (!Emu.GetIdManager().GetIDData(id, prx))
|
||||
return CELL_ESRCH;
|
||||
|
@ -10,8 +10,6 @@ s32 sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr
|
||||
{
|
||||
sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr());
|
||||
|
||||
if (!rw_lock_id.IsGood() || !attr.IsGood()) return CELL_EFAULT;
|
||||
|
||||
switch (attr->attr_protocol.ToBE())
|
||||
{
|
||||
case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Todo("SYS_SYNC_PRIORITY"); break;
|
||||
|
@ -14,11 +14,6 @@ s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, i
|
||||
sys_sem.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
|
||||
sem.GetAddr(), attr.GetAddr(), initial_count, max_count);
|
||||
|
||||
if (!sem.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (max_count <= 0 || initial_count > max_count || initial_count < 0)
|
||||
{
|
||||
sys_sem.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
|
||||
@ -199,11 +194,6 @@ s32 sys_semaphore_get_value(u32 sem_id, mem32_t count)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.GetAddr());
|
||||
|
||||
if (!count.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
Semaphore* sem;
|
||||
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
|
||||
{
|
||||
|
@ -28,14 +28,9 @@ u32 LoadSpuImage(vfsStream& stream, u32& spu_ep)
|
||||
//156
|
||||
s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
{
|
||||
const std::string path = Memory.ReadString(path_addr).c_str();
|
||||
const std::string path = Memory.ReadString(path_addr);
|
||||
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.c_str());
|
||||
|
||||
if(!img.IsGood() || !Memory.IsGoodAddr(path_addr))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
vfsFile f(path);
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
@ -66,19 +61,6 @@ s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if(!thread.IsGood() || !img.IsGood() || !attr.IsGood() || !arg.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (attr->name_addr)
|
||||
{
|
||||
if(!Memory.IsGoodAddr(attr->name_addr, attr->name_len))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if(spu_num >= group_info->list.size())
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
@ -104,10 +86,7 @@ s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
||||
|
||||
//copy SPU image:
|
||||
auto spu_offset = Memory.MainMem.AllocAlign(256 * 1024);
|
||||
if (!Memory.Copy(spu_offset, (u32)img->segs_addr, 256 * 1024))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
memcpy(Memory + spu_offset, Memory + (u32)img->segs_addr, 256 * 1024);
|
||||
|
||||
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_SPU);
|
||||
//initialize from new place:
|
||||
@ -135,16 +114,11 @@ s32 sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
sc_spu.Warning("sys_spu_thread_set_argument(id=%d, arg_addr=0x%x)", id, arg.GetAddr());
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if(!arg.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
thr->SetArg(0, arg->arg1);
|
||||
thr->SetArg(1, arg->arg2);
|
||||
thr->SetArg(2, arg->arg3);
|
||||
@ -158,14 +132,9 @@ s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
|
||||
|
||||
if (!status.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -286,10 +255,6 @@ s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
||||
sc_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)",
|
||||
id.GetAddr(), num, prio, attr.GetAddr());
|
||||
|
||||
if (!id.IsGood() || !attr.IsGood()) return CELL_EFAULT;
|
||||
|
||||
if (!Memory.IsGoodAddr(attr->name_addr, attr->name_len)) return CELL_EFAULT;
|
||||
|
||||
if (num > 256) return CELL_EINVAL;
|
||||
|
||||
if (prio < 16 || prio > 255) return CELL_EINVAL;
|
||||
@ -315,16 +280,6 @@ s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (cause.GetAddr() && !cause.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (status.GetAddr() && !status.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (group_info->lock.exchange(1)) // acquire lock
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
@ -382,7 +337,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -392,7 +347,7 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
|
||||
if (address >= 0x40000 || address + type > 0x40000 || address % type) // check range and alignment
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -415,7 +370,7 @@ s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -425,12 +380,7 @@ s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
if(!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
|
||||
if (address >= 0x40000 || address + type > 0x40000 || address % type) // check range and alignment
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -452,7 +402,7 @@ s32 sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -469,7 +419,7 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -491,7 +441,7 @@ s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -507,7 +457,7 @@ s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
sc_spu.Log("sys_spu_thread_write_snr(id=%d, number=%d, value=0x%x)", id, number, value);
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -550,7 +500,7 @@ s32 sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -599,7 +549,7 @@ s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -650,7 +600,7 @@ s32 sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -669,7 +619,7 @@ s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
|
||||
if(!thr || thr->GetType() != CPU_THREAD_SPU)
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
@ -687,11 +637,6 @@ s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, m
|
||||
sc_spu.Warning("sys_spu_thread_group_connect_event_all_threads(id=%d, eq_id=%d, req=0x%llx, spup_addr=0x%x)",
|
||||
id, eq_id, req, spup.GetAddr());
|
||||
|
||||
if (!spup.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
EventQueue* eq;
|
||||
if (!Emu.GetIdManager().GetIDData(eq_id, eq))
|
||||
{
|
||||
@ -817,11 +762,6 @@ s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (!intrtag.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
if (t->m_intrtag[class_id].enabled)
|
||||
{
|
||||
return CELL_EAGAIN;
|
||||
@ -856,11 +796,6 @@ s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.GetAddr());
|
||||
|
||||
if (!mask.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
{
|
||||
@ -899,11 +834,6 @@ s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.GetAddr());
|
||||
|
||||
if (!stat.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
{
|
||||
@ -923,11 +853,6 @@ s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
if (!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
{
|
||||
@ -958,11 +883,6 @@ s32 sys_raw_spu_get_spu_cfg(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
if (!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
|
||||
if (!t)
|
||||
{
|
||||
|
@ -58,6 +58,8 @@ u64 get_system_time()
|
||||
// Functions
|
||||
s32 sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
|
||||
{
|
||||
sys_time.Warning("sys_time_get_timezone(timezone_addr=0x%x, summertime_addr=0x%x)", timezone.GetAddr(), summertime.GetAddr());
|
||||
|
||||
int ret;
|
||||
ret = cellSysutilGetSystemParamInt(0x0116, timezone); //0x0116 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
|
||||
if (ret != CELL_OK) return ret;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define MHZ (10000000)
|
||||
#define MHZ (1000000)
|
||||
|
||||
// Auxiliary functions
|
||||
u64 get_time();
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "sys_timer.h"
|
||||
|
||||
SysCallBase sys_timer("sys_timer");
|
||||
@ -12,8 +11,6 @@ s32 sys_timer_create(mem32_t timer_id)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_create(timer_id_addr=0x%x)", timer_id.GetAddr());
|
||||
|
||||
if(!Memory.IsGoodAddr(timer_id.GetAddr())) return CELL_EFAULT;
|
||||
|
||||
timer_id = sys_timer.GetNewId(new timer);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -9,60 +9,60 @@ SysCallBase sys_trace("sys_trace");
|
||||
|
||||
s32 sys_trace_create()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_create()");
|
||||
sys_trace.Todo("sys_trace_create()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_start()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_start()");
|
||||
sys_trace.Todo("sys_trace_start()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_stop()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_stop()");
|
||||
sys_trace.Todo("sys_trace_stop()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_update_top_index()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_update_top_index()");
|
||||
sys_trace.Todo("sys_trace_update_top_index()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_destroy()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_destroy()");
|
||||
sys_trace.Todo("sys_trace_destroy()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_drain()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_drain()");
|
||||
sys_trace.Todo("sys_trace_drain()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_attach_process()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_attach_process()");
|
||||
sys_trace.Todo("sys_trace_attach_process()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_allocate_buffer()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_allocate_buffer()");
|
||||
sys_trace.Todo("sys_trace_allocate_buffer()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_free_buffer()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_free_buffer()");
|
||||
sys_trace.Todo("sys_trace_free_buffer()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_trace_create2()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_create2()");
|
||||
sys_trace.Todo("sys_trace_create2()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr)
|
||||
s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr)
|
||||
{
|
||||
if(ch > 15 || (s32)len <= 0) return CELL_EINVAL;
|
||||
if(!Memory.IsGoodAddr(buf_addr)) return CELL_EFAULT;
|
||||
|
||||
if (ch == SYS_TTYP_PPU_STDOUT || ch == SYS_TTYP_SPU_STDOUT || (ch >= SYS_TTYP_USER1 && ch <= SYS_TTYP_USER13)) {
|
||||
LOG_NOTICE(TTY, Memory.ReadString(buf_addr, len));
|
||||
@ -27,8 +26,6 @@ s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr)
|
||||
LOG_ERROR(TTY, Memory.ReadString(buf_addr, len));
|
||||
}
|
||||
|
||||
if(!Memory.IsGoodAddr(pwritelen_addr)) return CELL_EFAULT;
|
||||
|
||||
Memory.Write32(pwritelen_addr, len);
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -13,12 +13,6 @@ s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 a
|
||||
sc_vm.Warning("sys_vm_memory_map(vsize=0x%x,psize=0x%x,cidr=0x%x,flags=0x%llx,policy=0x%llx,addr=0x%x)",
|
||||
vsize, psize, cid, flag, policy, addr);
|
||||
|
||||
// Check output address.
|
||||
if(!Memory.IsGoodAddr(addr, 4))
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
// Check virtual size.
|
||||
if((vsize < (0x100000 * 32)) || (vsize > (0x100000 * 256)))
|
||||
{
|
||||
@ -83,7 +77,7 @@ s32 sys_vm_append_memory(u32 addr, u32 size)
|
||||
sc_vm.Warning("sys_vm_append_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -105,7 +99,7 @@ s32 sys_vm_return_memory(u32 addr, u32 size)
|
||||
sc_vm.Warning("sys_vm_return_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -127,7 +121,7 @@ s32 sys_vm_lock(u32 addr, u32 size)
|
||||
sc_vm.Warning("sys_vm_lock(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -149,7 +143,7 @@ s32 sys_vm_unlock(u32 addr, u32 size)
|
||||
sc_vm.Warning("sys_vm_unlock(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -161,10 +155,10 @@ s32 sys_vm_unlock(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_touch(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_touch(addr=0x%x,size=0x%x)", addr, size);
|
||||
sc_vm.Todo("sys_vm_touch(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -178,10 +172,10 @@ s32 sys_vm_touch(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_flush(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_flush(addr=0x%x,size=0x%x)", addr, size);
|
||||
sc_vm.Todo("sys_vm_flush(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -195,10 +189,10 @@ s32 sys_vm_flush(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_invalidate(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_invalidate(addr=0x%x,size=0x%x)", addr, size);
|
||||
sc_vm.Todo("sys_vm_invalidate(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -212,10 +206,10 @@ s32 sys_vm_invalidate(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_store(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_store(addr=0x%x,size=0x%x)", addr, size);
|
||||
sc_vm.Todo("sys_vm_store(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -229,10 +223,10 @@ s32 sys_vm_store(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_sync(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_sync(addr=0x%x,size=0x%x)", addr, size);
|
||||
sc_vm.Todo("sys_vm_sync(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -245,10 +239,10 @@ s32 sys_vm_sync(u32 addr, u32 size)
|
||||
|
||||
s32 sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_test(addr=0x%x,size=0x%x,result_addr=0x%x)", addr, size, result_addr);
|
||||
sc_vm.Todo("sys_vm_test(addr=0x%x,size=0x%x,result_addr=0x%x)", addr, size, result_addr);
|
||||
|
||||
// Check address and size.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
if((current_ct->addr != addr) || (current_ct->size < size) || (size <= 0))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
@ -264,10 +258,10 @@ s32 sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
||||
|
||||
s32 sys_vm_get_statistics(u32 addr, u32 stat_addr)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_get_statistics(addr=0x%x,stat_addr=0x%x)", addr, stat_addr);
|
||||
sc_vm.Todo("sys_vm_get_statistics(addr=0x%x,stat_addr=0x%x)", addr, stat_addr);
|
||||
|
||||
// Check address.
|
||||
if(!Memory.IsGoodAddr(addr, 4) || (current_ct->addr != addr))
|
||||
if(current_ct->addr != addr)
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
@ -416,7 +416,8 @@ void Emulator::Stop()
|
||||
GetKeyboardManager().Close();
|
||||
GetMouseManager().Close();
|
||||
GetCallbackManager().Clear();
|
||||
GetModuleManager().UnloadModules();
|
||||
GetModuleManager().UnloadModules();
|
||||
GetSFuncManager().StaticFinalize();
|
||||
|
||||
CurGameInfo.Reset();
|
||||
Memory.Close();
|
||||
|
@ -138,7 +138,7 @@ bool ELF32Loader::LoadPhdrInfo()
|
||||
phdr_arr.back().Load(elf32_f);
|
||||
}
|
||||
|
||||
if(/*!Memory.IsGoodAddr(entry)*/ entry & 0x1)
|
||||
if(entry & 0x1)
|
||||
{
|
||||
//entry is physical, convert to virtual
|
||||
|
||||
|
@ -343,9 +343,14 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
|
||||
const u32 nid = Memory.Read32(stub.s_nid + i*4);
|
||||
const u32 text = Memory.Read32(stub.s_text + i*4);
|
||||
|
||||
if (module && !module->Load(nid)) {
|
||||
if (module && !module->Load(nid))
|
||||
{
|
||||
LOG_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
|
||||
}
|
||||
else //if (Ini.HLELogging.GetValue())
|
||||
{
|
||||
LOG_NOTICE(LOADER, "Imported function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
|
||||
}
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "import %d:", i+1);
|
||||
LOG_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4);
|
||||
|
@ -95,6 +95,7 @@
|
||||
<ClCompile Include="Emu\SysCalls\lv2\lv2Fs.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_cond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_event.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_event_flag.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_interrupt.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwcond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwmutex.cpp" />
|
||||
@ -270,7 +271,7 @@
|
||||
<ClInclude Include="Emu\CPU\CPUThread.h" />
|
||||
<ClInclude Include="Emu\CPU\CPUThreadManager.h" />
|
||||
<ClInclude Include="Emu\DbgCommand.h" />
|
||||
<ClInclude Include="Emu\event.h" />
|
||||
<ClInclude Include="Emu\Event.h" />
|
||||
<ClInclude Include="Emu\FS\VFS.h" />
|
||||
<ClInclude Include="Emu\FS\vfsDevice.h" />
|
||||
<ClInclude Include="Emu\FS\vfsDeviceLocalFile.h" />
|
||||
@ -321,6 +322,7 @@
|
||||
<ClInclude Include="Emu\SysCalls\lv2\lv2Fs.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_cond.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_event.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_event_flag.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_interrupt.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwcond.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwmutex.h" />
|
||||
@ -568,4 +570,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -587,6 +587,9 @@
|
||||
<ClCompile Include="Emu\RSX\RSXThread.cpp">
|
||||
<Filter>Emu\RSX</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_event_flag.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Crypto\aes.h">
|
||||
@ -964,7 +967,7 @@
|
||||
<ClInclude Include="Emu\Io\XInput\XInputPadHandler.h">
|
||||
<Filter>Emu\Io\XInput</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\event.h">
|
||||
<ClInclude Include="Emu\Event.h">
|
||||
<Filter>Emu\SysCalls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Utilities\SSemaphore.h">
|
||||
@ -1117,5 +1120,8 @@
|
||||
<ClInclude Include="Emu\RSX\GCM.h">
|
||||
<Filter>Emu\RSX</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_event_flag.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user