1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

- Fixed OpenGL renderer LoadVertexArray & DrawArray.

- Improved SPU SCs.
- Renamed mem_ptr_t -> mem_list_ptr_t, mem_struct_ptr_t -> mem_ptr_t.
This commit is contained in:
DH 2013-11-19 23:10:23 +02:00
parent 5373747210
commit 9d5b13839b
24 changed files with 424 additions and 322 deletions

View File

@ -1,10 +1,48 @@
#pragma once
#pragma warning(disable: 4739)
template<typename T>
template<typename T, int size = sizeof(T)> struct se_t;
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
template<typename T, __int64 _value, int size = sizeof(T)> struct const_se_t;;
template<typename T, __int64 _value> struct const_se_t<T, _value, 1>
{
static const T value = (T)_value;
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 2>
{
static const T value = ((_value >> 8) & 0xff) | ((_value << 8) & 0xff00);
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 4>
{
static const T value =
((_value >> 24) & 0x000000ff) |
((_value >> 8) & 0x0000ff00) |
((_value << 8) & 0x00ff0000) |
((_value << 24) & 0xff000000);
};
template<typename T, __int64 _value> struct const_se_t<T, _value, 8>
{
static const T value =
((_value >> 56) & 0x00000000000000ff) |
((_value >> 40) & 0x000000000000ff00) |
((_value >> 24) & 0x0000000000ff0000) |
((_value >> 8) & 0x00000000ff000000) |
((_value << 8) & 0x000000ff00000000) |
((_value << 24) & 0x0000ff0000000000) |
((_value << 40) & 0x00ff000000000000) |
((_value << 56) & 0xff00000000000000);
};
template<typename T, int size=sizeof(T)>
class be_t
{
static_assert(sizeof(T) == 1 || sizeof(T) == 2 || sizeof(T) == 4 || sizeof(T) == 8, "Bad be_t type");
static_assert(size == 1 || size == 2 || size == 4 || size == 8, "Bad be_t type");
T m_data;
public:
@ -32,28 +70,7 @@ public:
{
T res;
switch(sizeof(T))
{
case 1:
(u8&)res = (u8&)m_data;
break;
case 2:
(u16&)res = _byteswap_ushort((u16&)m_data);
break;
case 4:
(u32&)res = _byteswap_ulong((u32&)m_data);
break;
case 8:
(u64&)res = _byteswap_uint64((u64&)m_data);
break;
default:
assert(0);
break;
}
se_t<T>::func(res, m_data);
return res;
}
@ -65,27 +82,7 @@ public:
void FromLE(const T& value)
{
switch(sizeof(T))
{
case 1:
(u8&)m_data = (u8&)value;
return;
case 2:
(u16&)m_data = _byteswap_ushort((u16&)value);
return;
case 4:
(u32&)m_data = _byteswap_ulong((u32&)value);
return;
case 8:
(u64&)m_data = _byteswap_uint64((u64&)value);
return;
}
assert(0);
m_data = value;
se_t<T>::func(m_data, value);
}
//template<typename T1>
@ -151,4 +148,4 @@ public:
template<typename T1> bool operator < (const be_t<T1>& right) const { return (T1)ToLE() < right.ToLE(); }
template<typename T1> bool operator >= (const be_t<T1>& right) const { return (T1)ToLE() >= right.ToLE(); }
template<typename T1> bool operator <= (const be_t<T1>& right) const { return (T1)ToLE() <= right.ToLE(); }
};
};

View File

@ -106,8 +106,9 @@ wxString GLFragmentDecompilerThread::AddReg(u32 index, int fp16)
*/
//ConLog.Warning("%c%d: %d %d", (fp16 ? 'h' : 'r'), index, dst.tex_num, src2.use_index_reg);
return m_parr.AddParam(fp16 ? PARAM_NONE : PARAM_OUT, "vec4",
wxString::Format((fp16 ? "h%u" : "r%u"), index), fp16 ? -1 : index);
wxString::Format((fp16 ? "h%u" : "r%u"), index), fp16 ? -1 : (!index ? 0 : ((index >= 2 && index <= 4) ? (index - 1) : -1)));
}
bool GLFragmentDecompilerThread::HasReg(u32 index, int fp16)
@ -226,6 +227,7 @@ void GLFragmentDecompilerThread::Task()
{
mem32_ptr_t data(m_addr);
m_size = 0;
m_location = 0;
while(true)
{
@ -320,6 +322,7 @@ void GLFragmentDecompilerThread::Task()
m_shader = BuildCode();
main.Clear();
m_parr.params.Clear();
}
GLShaderProgram::GLShaderProgram()

View File

@ -295,23 +295,12 @@ void GLGSRender::DisableVertexData()
for(u32 i=0; i<m_vertex_count; ++i)
{
if(!m_vertex_data[i].IsEnabled() || !m_vertex_data[i].addr) continue;
m_vertex_data[i].data.Clear();
glDisableVertexAttribArray(i);
checkForGlError("glDisableVertexAttribArray");
}
m_vao.Unbind();
}
void GLGSRender::LoadVertexData(u32 first, u32 count)
{
for(u32 i=0; i<m_vertex_count; ++i)
{
if(!m_vertex_data[i].IsEnabled()) continue;
m_vertex_data[i].Load(first, count);
}
}
void GLGSRender::InitVertexData()
{
for(u32 i=0; i<m_transform_constants.GetCount(); ++i)
@ -1020,10 +1009,10 @@ void GLGSRender::ExecCMD()
if(m_draw_array_count)
{
glDrawArrays(m_draw_mode - 1, 0, m_draw_array_count);
//ConLog.Warning("glDrawArrays(%d,%d,%d)", m_draw_mode - 1, m_draw_array_first, m_draw_array_count);
glDrawArrays(m_draw_mode - 1, m_draw_array_first, m_draw_array_count);
checkForGlError("glDrawArrays");
DisableVertexData();
m_draw_array_count = 0;
}
if(Ini.GSDumpColorBuffers.GetValue())

View File

@ -440,7 +440,6 @@ public:
private:
void EnableVertexData(bool indexed_draw=false);
void DisableVertexData();
void LoadVertexData(u32 first, u32 count);
void InitVertexData();
void InitFragmentData();

View File

@ -135,6 +135,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
}
SemaphorePostAndWait(m_sem_flip);
//Emu.Pause();
}
break;
@ -190,6 +192,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
u8 v2 = v >> 16;
u8 v3 = v >> 24;
m_vertex_data[index].Reset();
m_vertex_data[index].size = 4;
m_vertex_data[index].type = 4;
m_vertex_data[index].data.AddCpy(v0);
@ -208,6 +211,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
float v0 = (float&)a0;
float v1 = (float&)a1;
m_vertex_data[index].Reset();
m_vertex_data[index].type = 2;
m_vertex_data[index].size = 2;
m_vertex_data[index].data.SetCount(sizeof(float) * 2);
@ -230,6 +234,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
float v2 = (float&)a2;
float v3 = (float&)a3;
m_vertex_data[index].Reset();
m_vertex_data[index].type = 2;
m_vertex_data[index].size = 4;
m_vertex_data[index].data.SetCount(sizeof(float) * 4);
@ -440,6 +445,17 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
m_front_polygon_mode = args[0];
break;
case NV4097_CLEAR_ZCULL_SURFACE:
{
u32 a0 = args[0];
if(a0 & 0x01) m_clear_surface_z = m_clear_z;
if(a0 & 0x02) m_clear_surface_s = m_clear_s;
m_clear_surface_mask |= a0 & 0x3;
}
break;
case NV4097_CLEAR_SURFACE:
{
u32 a0 = args[0];
@ -513,8 +529,11 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
const u32 first = ac & 0xffffff;
const u32 _count = (ac >> 24) + 1;
//ConLog.Warning("NV4097_DRAW_ARRAYS: %d - %d", first, _count);
LoadVertexData(first, _count);
if(first < m_draw_array_first) m_draw_array_first = first;
m_draw_array_count += _count;
}
}
@ -575,6 +594,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
{
u32 a0 = args[0];
//ConLog.Warning("NV4097_SET_BEGIN_END: %x", a0);
if(a0)
{
Begin(a0);
@ -1296,6 +1317,8 @@ void RSXThread::Begin(u32 draw_mode)
{
m_begin_end = 1;
m_draw_mode = draw_mode;
m_draw_array_count = 0;
m_draw_array_first = ~0;
if(Emu.GetCallbackManager().m_exit_callback.m_callbacks.GetCount())
{
@ -1312,11 +1335,6 @@ void RSXThread::End()
//Emu.GetCallbackManager().m_exit_callback.Handle(0x0122, 0);
}
for(uint i=0; i<m_vertex_count; ++i)
{
m_vertex_data[i].Reset();
}
for(uint i=0; i<m_textures_count; ++i)
{
m_textures[i].m_enabled = false;
@ -1327,7 +1345,10 @@ void RSXThread::End()
m_transform_constants.Clear();
m_cur_shader_prog_num = 0;
Reset();
m_clear_surface_mask = 0;
m_begin_end = 0;
//Reset();
OnReset();
}

View File

@ -269,6 +269,7 @@ public:
u32 m_width, m_height;
u32 m_draw_array_count;
u32 m_draw_array_first;
public:
wxCriticalSection m_cs_main;
@ -512,6 +513,7 @@ protected:
, m_local_mem_addr(0)
, m_draw_mode(0)
, m_draw_array_count(0)
, m_draw_array_first(~0)
{
m_set_alpha_test = false;
m_set_blend = false;

View File

@ -4,6 +4,7 @@ enum PortStatus
{
CELL_PAD_STATUS_DISCONNECTED = 0x00000000,
CELL_PAD_STATUS_CONNECTED = 0x00000001,
CELL_PAD_STATUS_ASSIGN_CHANGES = 0x00000002,
};
enum PortSettings
@ -193,6 +194,9 @@ public:
{
Button& button = GetButtons(p).Get(b);
if(button.m_keyCode != code) continue;
GetPads()[p].m_port_status |= CELL_PAD_STATUS_ASSIGN_CHANGES;
if(button.m_pressed && !pressed)
{
button.m_flush = true;

View File

@ -401,23 +401,31 @@ public:
extern MemoryBase Memory;
template<typename T> class mem_struct_ptr_t
template<typename T>
class mem_base_t
{
const u32 m_addr;
protected:
u32 m_addr;
public:
mem_struct_ptr_t(u32 addr) : m_addr(addr)
mem_base_t(u32 addr) : m_addr(addr)
{
}
operator T&()
{
return (T&)Memory[m_addr];
}
u32 GetAddr() const { return m_addr; }
operator const T&() const
bool IsGood() const
{
return Memory.IsGoodAddr(m_addr, sizeof(T));
}
};
template<typename T>
class mem_ptr_t : public mem_base_t<T>
{
public:
mem_ptr_t(u32 addr) : mem_base_t<T>(addr)
{
return (const T&)Memory[m_addr];
}
T* operator -> ()
@ -430,6 +438,64 @@ public:
return (const T*)&Memory[m_addr];
}
mem_ptr_t operator++ (int)
{
mem_struct_ptr_t res(m_addr);
m_addr += sizeof(T);
return ret;
}
mem_ptr_t& operator++ ()
{
m_addr += sizeof(T);
return *this;
}
mem_ptr_t operator-- (int)
{
mem_struct_ptr_t res(m_addr);
m_addr -= sizeof(T);
return ret;
}
mem_ptr_t& operator-- ()
{
m_addr -= sizeof(T);
return *this;
}
mem_ptr_t& operator += (uint count)
{
m_addr += count * sizeof(T);
return *this;
}
mem_ptr_t& operator -= (uint count)
{
m_addr -= count * sizeof(T);
return *this;
}
mem_ptr_t operator + (uint count) const
{
return m_addr + count * sizeof(T);
}
mem_ptr_t operator - (uint count) const
{
return m_addr - count * sizeof(T);
}
T& operator *()
{
return (T&)Memory[m_addr];
}
const T& operator *() const
{
return (T&)Memory[m_addr];
}
T& operator [](uint index)
{
return (T&)Memory[m_addr + sizeof(T) * index];
@ -440,26 +506,34 @@ public:
return (const T&)Memory[m_addr + sizeof(T) * index];
}
u32 GetAddr() const { return m_addr; }
operator bool() const { return m_addr == 0; }
bool IsGood() const
{
return Memory.IsGoodAddr(m_addr, sizeof(T));
}
bool operator == (mem_ptr_t right) const { return m_addr == right.m_addr; }
bool operator != (mem_ptr_t right) const { return m_addr != right.m_addr; }
bool operator > (mem_ptr_t right) const { return m_addr > right.m_addr; }
bool operator < (mem_ptr_t right) const { return m_addr < right.m_addr; }
bool operator >= (mem_ptr_t right) const { return m_addr >= right.m_addr; }
bool operator <= (mem_ptr_t right) const { return m_addr <= right.m_addr; }
mem_struct_ptr_t& operator = (const T& right)
{
memcpy(&Memory[m_addr], &right, sizeof(T));
return *this;
}
bool operator == (T* right) const { return (T*)&Memory[m_addr] == right; }
bool operator != (T* right) const { return (T*)&Memory[m_addr] != right; }
bool operator > (T* right) const { return (T*)&Memory[m_addr] > right; }
bool operator < (T* right) const { return (T*)&Memory[m_addr] < right; }
bool operator >= (T* right) const { return (T*)&Memory[m_addr] >= right; }
bool operator <= (T* right) const { return (T*)&Memory[m_addr] <= right; }
};
template<typename T> class mem_t
{
const u32 m_addr;
template<typename T> static bool operator == (T* left, mem_ptr_t<T> right) { return left == (T*)&Memory[right.GetAddr()]; }
template<typename T> static bool operator != (T* left, mem_ptr_t<T> right) { return left != (T*)&Memory[right.GetAddr()]; }
template<typename T> static bool operator > (T* left, mem_ptr_t<T> right) { return left > (T*)&Memory[right.GetAddr()]; }
template<typename T> static bool operator < (T* left, mem_ptr_t<T> right) { return left < (T*)&Memory[right.GetAddr()]; }
template<typename T> static bool operator >= (T* left, mem_ptr_t<T> right) { return left >= (T*)&Memory[right.GetAddr()]; }
template<typename T> static bool operator <= (T* left, mem_ptr_t<T> right) { return left <= (T*)&Memory[right.GetAddr()]; }
template<typename T> class mem_t : public mem_base_t<T>
{
public:
mem_t(u32 addr) : m_addr(addr)
mem_t(u32 addr) : mem_base_t<T>(addr)
{
}
@ -485,21 +559,12 @@ public:
mem_t& operator ^= (T right) { return *this = (*this) ^ right; }
mem_t& operator <<= (T right) { return *this = (*this) << right; }
mem_t& operator >>= (T right) { return *this = (*this) >> right; }
u32 GetAddr() const { return m_addr; }
bool IsGood() const
{
return Memory.IsGoodAddr(m_addr, sizeof(T));
}
};
template<typename T> class mem_ptr_t
template<typename T> class mem_list_ptr_t : public mem_base_t<T>
{
u32 m_addr;
public:
mem_ptr_t(u32 addr) : m_addr(addr)
mem_list_ptr_t(u32 addr) : mem_base_t<T>(addr)
{
}
@ -515,7 +580,6 @@ public:
return m_addr;
}
u32 GetAddr() const { return m_addr; }
u32 Skip(const u32 offset) { return m_addr += offset; }
operator be_t<T>*() { return GetPtr(); }
@ -661,7 +725,7 @@ public:
return GetAddr();
}
operator const mem_struct_ptr_t<T>() const
operator const mem_ptr_t<T>() const
{
return GetAddr();
}
@ -678,7 +742,19 @@ typedef mem_t<u16> mem16_t;
typedef mem_t<u32> mem32_t;
typedef mem_t<u64> mem64_t;
typedef mem_ptr_t<u8> mem8_ptr_t;
typedef mem_ptr_t<u16> mem16_ptr_t;
typedef mem_ptr_t<u32> mem32_ptr_t;
typedef mem_ptr_t<u64> mem64_ptr_t;
/*
typedef mem_ptr_t<be_t<u8>> mem8_ptr_t;
typedef mem_ptr_t<be_t<u16>> mem16_ptr_t;
typedef mem_ptr_t<be_t<u32>> mem32_ptr_t;
typedef mem_ptr_t<be_t<u64>> mem64_ptr_t;
typedef mem_list_ptr_t<u8> mem8_lptr_t;
typedef mem_list_ptr_t<u16> mem16_lptr_t;
typedef mem_list_ptr_t<u32> mem32_lptr_t;
typedef mem_list_ptr_t<u64> mem64_lptr_t;
*/
typedef mem_list_ptr_t<u8> mem8_ptr_t;
typedef mem_list_ptr_t<u16> mem16_ptr_t;
typedef mem_list_ptr_t<u32> mem32_ptr_t;
typedef mem_list_ptr_t<u64> mem64_ptr_t;

View File

@ -26,18 +26,16 @@ struct gcm_offset
u32 map_offset_addr = 0;
u32 map_offset_pos = 0;
int cellGcmMapMainMemory(u32 address, u32 size, u32 offset_addr)
int cellGcmMapMainMemory(u32 address, u32 size, mem32_t offset)
{
cellGcmSys.Warning("cellGcmMapMainMemory(address=0x%x,size=0x%x,offset_addr=0x%x)", address, size, offset_addr);
if(!Memory.IsGoodAddr(offset_addr, sizeof(u32))) return CELL_EFAULT;
cellGcmSys.Warning("cellGcmMapMainMemory(address=0x%x,size=0x%x,offset_addr=0x%x)", address, size, offset.GetAddr());
if(!offset.IsGood()) return CELL_EFAULT;
Emu.GetGSManager().GetRender().m_main_mem_addr = Emu.GetGSManager().GetRender().m_ioAddress;
u32 offset = address - Emu.GetGSManager().GetRender().m_main_mem_addr;
offset = address - Emu.GetGSManager().GetRender().m_main_mem_addr;
Emu.GetGSManager().GetRender().m_main_mem_info.AddCpy(MemInfo(address, size));
Memory.Write32(offset_addr, offset);
return CELL_OK;
}
@ -92,20 +90,21 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
return CELL_OK;
}
int cellGcmGetConfiguration(u32 config_addr)
int cellGcmGetConfiguration(mem_ptr_t<CellGcmConfig> config)
{
cellGcmSys.Log("cellGcmGetConfiguration(config_addr=0x%x)", config_addr);
cellGcmSys.Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr());
if(!Memory.IsGoodAddr(config_addr, sizeof(CellGcmConfig))) return CELL_EFAULT;
if(!config.IsGood()) return CELL_EFAULT;
*config = current_config;
Memory.WriteData(config_addr, current_config);
return CELL_OK;
}
int cellGcmAddressToOffset(u32 address, u32 offset_addr)
int cellGcmAddressToOffset(u32 address, mem32_t offset)
{
cellGcmSys.Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset_addr);
if(!Memory.IsGoodAddr(offset_addr, sizeof(u32))) return CELL_EFAULT;
cellGcmSys.Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.GetAddr());
if(!offset.IsGood()) return CELL_EFAULT;
if(!map_offset_addr)
{
@ -144,13 +143,11 @@ int cellGcmAddressToOffset(u32 address, u32 offset_addr)
//ConLog.Warning("cellGcmAddressToOffset: io memory: offset = 0x%x - 0x%x = 0x%x", address, sa, address - sa);
}
u32 offset = address - sa;
offset = address - sa;
//Memory.Write16(map_offset_addr + map_offset_pos + 0, ea);
//Memory.Write16(map_offset_addr + map_offset_pos + 2, offset);
//map_offset_pos += 4;
Memory.Write32(offset_addr, offset);
return CELL_OK;
}
@ -188,9 +185,9 @@ u32 cellGcmGetControlRegister()
return gcm_info.control_addr;
}
int cellGcmSetPrepareFlip(u32 ctx, u32 id)
int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
{
cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctx, id);
cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id);
if(id >= 8)
{
@ -198,22 +195,22 @@ int cellGcmSetPrepareFlip(u32 ctx, u32 id)
}
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
CellGcmContextData& ctxt = (CellGcmContextData&)Memory[ctx];
u32 current = re(ctxt.current);
u32 end = re(ctxt.end);
u32 current = re(ctxt->current);
u32 end = re(ctxt->end);
if(current + 8 >= end)
{
ConLog.Warning("bad flip!");
cellGcmCallback(ctx, current + 8 - end);
cellGcmCallback(ctxt.GetAddr(), current + 8 - end);
}
current = re(ctxt.current);
current = re(ctxt->current);
Memory.Write32(current, 0x3fead | (1 << 18));
Memory.Write32(current + 4, id);
re(ctxt.current, current + 8);
re(ctxt->current, current + 8);
if(ctx == gcm_info.context_addr)
if(ctxt.GetAddr() == gcm_info.context_addr)
{
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
re(ctrl.put, re(ctrl.put) + 8);
@ -331,13 +328,13 @@ u64 cellGcmGetTimeStamp(u32 index)
int cellGcmSetFlipHandler(u32 handler_addr)
{
cellGcmSys.Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler_addr);
if(!Memory.IsGoodAddr(handler_addr) && handler_addr != 0)
if(handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
{
return CELL_EFAULT;
}
Emu.GetGSManager().GetRender().m_flip_handler.SetAddr(handler_addr);
return 0;
return CELL_OK;
}
s64 cellGcmFunc15()

View File

@ -132,7 +132,7 @@ int cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u
return CELL_OK;
}
int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_struct_ptr_t<CellGifDecSrc> src, mem_struct_ptr_t<CellGifDecOpnInfo> openInfo)
int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDecSrc> src, mem_ptr_t<CellGifDecOpnInfo> openInfo)
{
/*
vfsStream* stream;
@ -182,7 +182,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_struct_ptr_t<Cel
return CELL_OK;
}
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellGifDecInfo> info)
int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo> info)
{
ID sub_handle_id_data;
if(!cellGifDec.CheckId(subHandle, sub_handle_id_data))
@ -217,12 +217,12 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellGif
current_info.SBackGroundColor = buffer[11];
current_info.SPixelAspectRatio = buffer[12];
info = current_info;
*info = current_info;
return CELL_OK;
}
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t<CellGifDecInParam> inParam, mem_struct_ptr_t<CellGifDecOutParam> outParam)
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGifDecInParam> inParam, mem_ptr_t<CellGifDecOutParam> outParam)
{
ID sub_handle_id_data;
if(!cellGifDec.CheckId(subHandle, sub_handle_id_data))
@ -246,12 +246,12 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t
current_outParam.outputBitDepth = 0; // Unimplemented
current_outParam.useMemorySpace = 0; // Unimplemented
outParam = current_outParam;
*outParam = current_outParam;
return CELL_OK;
}
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_struct_ptr_t<CellGifDecDataCtrlParam> dataCtrlParam, mem_struct_ptr_t<CellGifDecDataOutInfo> dataOutInfo)
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellGifDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellGifDecDataOutInfo> dataOutInfo)
{
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;

View File

@ -126,7 +126,7 @@ int cellJpgDecDestroy(u32 mainHandle)
return CELL_OK;
}
int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, mem_struct_ptr_t<CellJpgDecOpnInfo> openInfo)
int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, mem_ptr_t<CellJpgDecOpnInfo> openInfo)
{
//u32 srcSelect = Memory.Read32(src_addr);
u32 fileName = Memory.Read32(src_addr+4);
@ -170,7 +170,7 @@ int cellJpgDecClose(u32 mainHandle, u32 subHandle)
return CELL_OK;
}
int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellJpgDecInfo> info)
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());
ID sub_handle_id_data;
@ -224,12 +224,12 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellJpg
current_info.numComponents = 3; // Unimplemented
current_info.colorSpace = CELL_JPG_RGB;
info = current_info;
*info = current_info;
return CELL_OK;
}
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_struct_ptr_t<CellJpgDecDataCtrlParam> dataCtrlParam, mem_struct_ptr_t<CellJpgDecDataOutInfo> dataOutInfo)
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellJpgDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellJpgDecDataOutInfo> dataOutInfo)
{
dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
ID sub_handle_id_data;
@ -295,7 +295,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
return CELL_OK;
}
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t<CellJpgDecInParam> inParam, mem_struct_ptr_t<CellJpgDecOutParam> outParam)
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellJpgDecInParam> inParam, mem_ptr_t<CellJpgDecOutParam> outParam)
{
ID sub_handle_id_data;
if(!cellJpgDec.CheckId(subHandle, sub_handle_id_data))
@ -332,7 +332,7 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t
current_outParam.downScale = inParam->downScale;
current_outParam.useMemorySpace = 0; // Unimplemented
outParam = current_outParam;
*outParam = current_outParam;
return CELL_OK;
}

View File

@ -160,7 +160,7 @@ int cellPngDecClose(u32 mainHandle, u32 subHandle)
return CELL_OK;
}
int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellPngDecInfo> info)
int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo> info)
{
cellPngDec.Log("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
ID sub_handle_id_data;
@ -206,12 +206,12 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_struct_ptr_t<CellPng
current_info.interlaceMethod = buffer.To<u8>()[28];
current_info.chunkInformation = 0; // Unimplemented
info = current_info;
*info = current_info;
return CELL_OK;
}
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_struct_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam, mem_struct_ptr_t<CellPngDecDataOutInfo> dataOutInfo)
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellPngDecDataOutInfo> dataOutInfo)
{
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
ID sub_handle_id_data;
@ -271,7 +271,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
return CELL_OK;
}
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t<CellPngDecInParam> inParam, mem_struct_ptr_t<CellPngDecOutParam> outParam)
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPngDecInParam> inParam, mem_ptr_t<CellPngDecOutParam> outParam)
{
ID sub_handle_id_data;
if(!cellPngDec.CheckId(subHandle, sub_handle_id_data))
@ -305,7 +305,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_struct_ptr_t
current_outParam.outputMode = inParam->outputMode;
current_outParam.useMemorySpace = 0; // Unimplemented
outParam = current_outParam;
*outParam = current_outParam;
return CELL_OK;
}

View File

@ -76,9 +76,9 @@ CCellRescInternal* s_rescInternalInstance = new CCellRescInternal();
// Extern Functions
extern int cellGcmSetFlipMode(u32 mode);
extern int cellGcmSetFlipHandler(u32 handler_addr);
extern int cellGcmAddressToOffset(u32 address, u32 offset_addr);
extern int cellGcmAddressToOffset(u32 address, mem32_t offset);
extern int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height);
extern int cellGcmSetPrepareFlip(u32 ctx, u32 id);
extern int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctx, u32 id);
int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved);
// Help Functions
@ -112,9 +112,7 @@ void BuildupVertexBufferNR()
float U_PS0 = UV_CENTER - U_PS;
float U_PS1 = UV_CENTER + U_PS;
mem_struct_ptr_t<RescVertex_t> vv(s_rescInternalInstance->m_vertexArrayEA_addr);
int i = 0;
mem_ptr_t<RescVertex_t> vv(s_rescInternalInstance->m_vertexArrayEA_addr);
if(s_rescInternalInstance->m_dstMode == CELL_RESC_720x480 || s_rescInternalInstance->m_dstMode == CELL_RESC_720x576){
switch(s_rescInternalInstance->m_initConfig.ratioMode){
@ -127,26 +125,26 @@ void BuildupVertexBufferNR()
}
NR_FULLSCREEN:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS0; vv[i].v = V_FS0; vv[i].u2 = 0.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS1; vv[i].v = V_FS0; vv[i].u2 = 1.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS1; vv[i].v = V_FS1; vv[i].u2 = 1.0f; vv[i].v2 = 1.0f; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS0; vv[i].v = V_FS1; vv[i].u2 = 0.0f; vv[i].v2 = 1.0f; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_FS0; vv->v = V_FS0; vv->u2 = 0.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_FS1; vv->v = V_FS0; vv->u2 = 1.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_FS1; vv->v = V_FS1; vv->u2 = 1.0f; vv->v2 = 1.0f; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_FS0; vv->v = V_FS1; vv->u2 = 0.0f; vv->v2 = 1.0f; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
NR_LETTERBOX:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS0; vv[i].v = V_LB0; vv[i].u2 = 0.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS1; vv[i].v = V_LB0; vv[i].u2 = 1.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS1; vv[i].v = V_LB1; vv[i].u2 = 1.0f; vv[i].v2 = 1.0f; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS0; vv[i].v = V_LB1; vv[i].u2 = 0.0f; vv[i].v2 = 1.0f; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_FS0; vv->v = V_LB0; vv->u2 = 0.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_FS1; vv->v = V_LB0; vv->u2 = 1.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_FS1; vv->v = V_LB1; vv->u2 = 1.0f; vv->v2 = 1.0f; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_FS0; vv->v = V_LB1; vv->u2 = 0.0f; vv->v2 = 1.0f; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
NR_PANSCAN:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_PS0; vv[i].v = V_FS0; vv[i].u2 = 0.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_PS1; vv[i].v = V_FS0; vv[i].u2 = 1.0f; vv[i].v2 = 0.0f; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_PS1; vv[i].v = V_FS1; vv[i].u2 = 1.0f; vv[i].v2 = 1.0f; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_PS0; vv[i].v = V_FS1; vv[i].u2 = 0.0f; vv[i].v2 = 1.0f; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_PS0; vv->v = V_FS0; vv->u2 = 0.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_PS1; vv->v = V_FS0; vv->u2 = 1.0f; vv->v2 = 0.0f; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_PS1; vv->v = V_FS1; vv->u2 = 1.0f; vv->v2 = 1.0f; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_PS0; vv->v = V_FS1; vv->u2 = 0.0f; vv->v2 = 1.0f; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
}
@ -190,9 +188,7 @@ void BuildupVertexBufferUN(s32 srcIdx)
float U2_FS1 = s_rescInternalInstance->m_dstWidth;
float V2_FS1 = s_rescInternalInstance->m_dstHeight;
mem_struct_ptr_t<RescVertex_t> vv(s_rescInternalInstance->m_vertexArrayEA_addr);
int i = 0;
mem_ptr_t<RescVertex_t> vv(s_rescInternalInstance->m_vertexArrayEA_addr);
if(s_rescInternalInstance->m_dstMode == CELL_RESC_720x480 || s_rescInternalInstance->m_dstMode == CELL_RESC_720x576){
switch(s_rescInternalInstance->m_initConfig.ratioMode){
@ -205,31 +201,31 @@ void BuildupVertexBufferUN(s32 srcIdx)
}
UN_FULLSCREEN:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS0; vv[i].v = V_FS0; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS1; vv[i].v = V_FS0; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS1; vv[i].v = V_FS1; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS1; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS0; vv[i].v = V_FS1; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS1; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_FS0; vv->v = V_FS0; vv->u2 = U2_FS0; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_FS1; vv->v = V_FS0; vv->u2 = U2_FS1; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_FS1; vv->v = V_FS1; vv->u2 = U2_FS1; vv->v2 = V2_FS1; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_FS0; vv->v = V_FS1; vv->u2 = U2_FS0; vv->v2 = V2_FS1; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
UN_LETTERBOX:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS0; vv[i].v = V_LB0; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_FS1; vv[i].v = V_LB0; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS1; vv[i].v = V_LB1; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS1; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_FS0; vv[i].v = V_LB1; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS1; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_FS0; vv->v = V_LB0; vv->u2 = U2_FS0; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_FS1; vv->v = V_LB0; vv->u2 = U2_FS1; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_FS1; vv->v = V_LB1; vv->u2 = U2_FS1; vv->v2 = V2_FS1; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_FS0; vv->v = V_LB1; vv->u2 = U2_FS0; vv->v2 = V2_FS1; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
UN_PANSCAN:
vv[i].Px = -PX_FS; vv[i].Py = PY_FS; vv[i].u = U_PS0; vv[i].v = V_FS0; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = PY_FS; vv[i].u = U_PS1; vv[i].v = V_FS0; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS0; i++;
vv[i].Px = PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_PS1; vv[i].v = V_FS1; vv[i].u2 = U2_FS1; vv[i].v2 = V2_FS1; i++;
vv[i].Px = -PX_FS; vv[i].Py = -PY_FS; vv[i].u = U_PS0; vv[i].v = V_FS1; vv[i].u2 = U2_FS0; vv[i].v2 = V2_FS1; i++;
vv->Px = -PX_FS; vv->Py = PY_FS; vv->u = U_PS0; vv->v = V_FS0; vv->u2 = U2_FS0; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = PY_FS; vv->u = U_PS1; vv->v = V_FS0; vv->u2 = U2_FS1; vv->v2 = V2_FS0; ++vv;
vv->Px = PX_FS; vv->Py = -PY_FS; vv->u = U_PS1; vv->v = V_FS1; vv->u2 = U2_FS1; vv->v2 = V2_FS1; ++vv;
vv->Px = -PX_FS; vv->Py = -PY_FS; vv->u = U_PS0; vv->v = V_FS1; vv->u2 = U2_FS0; vv->v2 = V2_FS1; ++vv;
s_rescInternalInstance->m_nVertex = VERTEX_NUMBER_NORMAL;
return;
}
inline int InternalVersion(mem_struct_ptr_t<CellRescInitConfig> conf)
inline int InternalVersion(mem_ptr_t<CellRescInitConfig> conf)
{
switch (conf->size)
{
@ -335,7 +331,7 @@ int CalculateMaxColorBuffersSize()
return maxBufSize;
}
bool CheckInitConfig(mem_struct_ptr_t<CellRescInitConfig> initConfig)
bool CheckInitConfig(mem_ptr_t<CellRescInitConfig> initConfig)
{
if( (initConfig->resourcePolicy & ~((u32)0x3)) ||
(initConfig->supportModes & 0xF) == 0 ||
@ -360,7 +356,7 @@ void InitMembers()
{
}
void InitContext(mem_struct_ptr_t<CellGcmContextData>& cntxt)
void InitContext(mem_ptr_t<CellGcmContextData>& cntxt)
{
//TODO: use cntxt
GSLockCurrent lock(GS_LOCK_WAIT_FLUSH);
@ -406,7 +402,7 @@ void InitContext(mem_struct_ptr_t<CellGcmContextData>& cntxt)
}
}
void InitVertex(mem_struct_ptr_t<CellGcmContextData>& cntxt)
void InitVertex(mem_ptr_t<CellGcmContextData>& cntxt)
{
GSLockCurrent lock(GS_LOCK_WAIT_FLUSH);
GSRender& r = Emu.GetGSManager().GetRender();
@ -415,7 +411,7 @@ void InitVertex(mem_struct_ptr_t<CellGcmContextData>& cntxt)
}
// Module Functions
int cellRescInit(mem_struct_ptr_t<CellRescInitConfig> initConfig)
int cellRescInit(mem_ptr_t<CellRescInitConfig> initConfig)
{
cellResc.Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.GetAddr());
@ -425,7 +421,7 @@ int cellRescInit(mem_struct_ptr_t<CellRescInitConfig> initConfig)
return CELL_RESC_ERROR_BAD_ARGUMENT;
InitMembers();
s_rescInternalInstance->m_initConfig = initConfig; // TODO: This may be incompatible with older binaries
s_rescInternalInstance->m_initConfig = *initConfig; // TODO: This may be incompatible with older binaries
s_rescInternalInstance->m_bInitialized = true;
return CELL_OK;
@ -461,7 +457,7 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t buffer
return CELL_OK;
}
int cellRescSetDsts(u32 dstsMode, mem_struct_ptr_t<CellRescDsts> dsts)
int cellRescSetDsts(u32 dstsMode, mem_ptr_t<CellRescDsts> dsts)
{
cellResc.Log("cellRescSetDsts(dstsMode=%d, CellRescDsts_addr=0x%x)", dstsMode, dsts.GetAddr());
@ -474,7 +470,7 @@ int cellRescSetDsts(u32 dstsMode, mem_struct_ptr_t<CellRescDsts> dsts)
(dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080))
return CELL_RESC_ERROR_BAD_ARGUMENT;
s_rescInternalInstance->m_rescDsts[GetRescDestsIndex(dstsMode)] = dsts;
s_rescInternalInstance->m_rescDsts[GetRescDestsIndex(dstsMode)] = *dsts;
return CELL_OK;
}
@ -636,7 +632,7 @@ int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved)
: 2;
}
int cellRescGcmSurface2RescSrc(mem_struct_ptr_t<CellGcmSurface> gcmSurface, mem_struct_ptr_t<CellRescSrc> rescSrc)
int cellRescGcmSurface2RescSrc(mem_ptr_t<CellGcmSurface> gcmSurface, mem_ptr_t<CellRescSrc> rescSrc)
{
cellResc.Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)",
gcmSurface.GetAddr(), rescSrc.GetAddr());
@ -664,7 +660,7 @@ int cellRescGcmSurface2RescSrc(mem_struct_ptr_t<CellGcmSurface> gcmSurface, mem_
return CELL_OK;
}
int cellRescSetSrc(s32 idx, mem_struct_ptr_t<CellRescSrc> src)
int cellRescSetSrc(s32 idx, mem_ptr_t<CellRescSrc> src)
{
cellResc.Log("cellRescSetSrc(idx=0x%x, src_addr=0x%x)", idx, src.GetAddr());
@ -683,14 +679,14 @@ int cellRescSetSrc(s32 idx, mem_struct_ptr_t<CellRescSrc> src)
//Emu.GetGSManager().GetRender().SetData(src.offset, 800, 600);
//Emu.GetGSManager().GetRender().Draw();
s_rescInternalInstance->m_rescSrc[idx] = src;
s_rescInternalInstance->m_rescSrc[idx] = *src;
cellGcmSetDisplayBuffer(idx, src->offset, src->pitch, src->width, src->height);
return 0;
}
int cellRescSetConvertAndFlip(mem_struct_ptr_t<CellGcmContextData> cntxt, s32 idx)
int cellRescSetConvertAndFlip(mem_ptr_t<CellGcmContextData> cntxt, s32 idx)
{
cellResc.Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.GetAddr(), idx);
@ -707,7 +703,7 @@ int cellRescSetConvertAndFlip(mem_struct_ptr_t<CellGcmContextData> cntxt, s32 id
//TODO: ?
cellGcmSetPrepareFlip(cntxt.GetAddr(), idx);
cellGcmSetPrepareFlip(cntxt, idx);
return CELL_OK;
}
@ -738,12 +734,12 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t
s_rescInternalInstance->m_vertexArrayEA_addr = vertexArray.GetAddr();
s_rescInternalInstance->m_fragmentUcodeEA_addr = fragmentShader.GetAddr();
MemoryAllocator<u32> dstOffset;
cellGcmAddressToOffset(s_rescInternalInstance->m_colorBuffersEA_addr, dstOffset.GetAddr());
MemoryAllocator<be_t<u32>> dstOffset;
cellGcmAddressToOffset(s_rescInternalInstance->m_colorBuffersEA_addr, dstOffset);
for(int i=0; i<GetNumColorBuffers(); i++)
{
s_rescInternalInstance->m_dstOffsets[i] = dstOffset + i * s_rescInternalInstance->m_dstBufInterval;
s_rescInternalInstance->m_dstOffsets[i] = dstOffset->ToLE() + i * s_rescInternalInstance->m_dstBufInterval;
}
for(int i=0; i<GetNumColorBuffers(); i++)

View File

@ -331,7 +331,7 @@ int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr)
return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT;
}
int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_struct_ptr_t<CellVideoOutDeviceInfo> info)
int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_ptr_t<CellVideoOutDeviceInfo> info)
{
cellSysutil.Error("Unimplemented function: cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)",
videoOut, deviceIndex, info.GetAddr());

View File

@ -2,10 +2,19 @@
#define RESULT(x) SC_ARGS_1 = (x)
template<bool is_fp, typename T> struct get_arg { static __forceinline T func(PPUThread& CPU, int i) { return (T&)CPU.GPR[i + 2]; } };
template<typename T> struct get_arg<true, T> { static __forceinline T func(PPUThread& CPU, int i) { return CPU.FPR[i]; } };
template<bool is_fp, bool is_ptr, typename T>
struct get_arg;
#define ARG(n) get_arg<std::is_floating_point<T##n>::value, T##n>::func(CPU, n)
template<typename T>
struct get_arg<false, false, T> { static __forceinline T func(PPUThread& CPU, int i) { return (T&)CPU.GPR[i + 2]; } };
template<bool is_fp, typename T>
struct get_arg<is_fp, true, T> { static __forceinline T func(PPUThread& CPU, int i) { return CPU.GPR[i + 2] ? (T)&Memory[CPU.GPR[i + 2]] : nullptr; } };
template<typename T>
struct get_arg<true, false, T> { static __forceinline T func(PPUThread& CPU, int i) { return CPU.FPR[i]; } };
#define ARG(n) get_arg<std::is_floating_point<T##n>::value, std::is_pointer<T##n>::value, T##n>::func(CPU, n)
template<typename TR>
class binder_func_0 : public func_caller

View File

@ -98,7 +98,7 @@ static func_caller* sc_table[1024] =
null_func, null_func, null_func, null_func, null_func, //179
null_func, bind_func(sys_spu_thread_write_ls), bind_func(sys_spu_thread_read_ls), null_func, null_func, //184
null_func, null_func, null_func, null_func, null_func, //189
bind_func(sys_spu_thread_write_spu_mb), null_func, null_func, null_func, null_func, //194
bind_func(sys_spu_thread_write_spu_mb), bind_func(sys_spu_thread_connect_event), null_func, null_func, null_func, //194
null_func, null_func, null_func, null_func, null_func, //199
null_func, null_func, null_func, null_func, null_func, //204
null_func, null_func, null_func, null_func, null_func, //209

View File

@ -3,6 +3,7 @@
#include "lv2/SC_FileSystem.h"
#include "lv2/SC_Timer.h"
#include "lv2/SC_Rwlock.h"
#include "lv2/SC_SPU_Thread.h"
//#define SYSCALLS_DEBUG
#define declCPU PPUThread& CPU = GetCurrentPPUThread
@ -189,8 +190,8 @@ extern int cellFsClose(u32 fd);
extern int cellFsOpendir(u32 path_addr, mem32_t fd);
extern int cellFsReaddir(u32 fd, u32 dir_addr, mem64_t nread);
extern int cellFsClosedir(u32 fd);
extern int cellFsStat(u32 path_addr, mem_struct_ptr_t<CellFsStat> sb);
extern int cellFsFstat(u32 fd, mem_struct_ptr_t<CellFsStat> sb);
extern int cellFsStat(u32 path_addr, mem_ptr_t<CellFsStat> sb);
extern int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb);
extern int cellFsMkdir(u32 path_addr, u32 mode);
extern int cellFsRename(u32 from_addr, u32 to_addr);
extern int cellFsRmdir(u32 path_addr);
@ -257,16 +258,17 @@ extern int sys_heap_create_heap(const u32 heap_addr, const u32 start_addr, const
extern int sys_heap_malloc(const u32 heap_addr, const u32 size);
//sys_spu
extern int sys_spu_image_open(u32 img_addr, u32 path_addr);
extern int sys_spu_thread_initialize(u32 thread_addr, u32 group, u32 spu_num, u32 img_addr, u32 attr_addr, u32 arg_addr);
extern int sys_spu_thread_set_argument(u32 id, u32 arg_addr);
extern int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr);
extern int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg);
extern int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg);
extern int sys_spu_thread_group_start(u32 id);
extern int sys_spu_thread_group_create(u64 id_addr, u32 num, int prio, u64 attr_addr);
extern int sys_spu_thread_create(u64 thread_id_addr, u64 entry_addr, u64 arg, int prio, u32 stacksize, u64 flags, u64 threadname_addr);
extern int sys_raw_spu_create(u32 id_addr, u32 attr_addr);
extern int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr);
extern int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr);
extern int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup);
extern int sys_raw_spu_create(mem32_t id, u32 attr_addr);
extern int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
extern int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type);
extern int sys_spu_thread_read_ls(u32 id, u32 address, u32 value_addr, u32 type);
extern int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type);
extern int sys_spu_thread_write_spu_mb(u32 id, u32 value);
//sys_time
@ -278,7 +280,7 @@ extern u64 sys_time_get_timebase_frequency();
//sys_timer
extern int sys_timer_create(mem32_t timer_id);
extern int sys_timer_destroy(u32 timer_id);
extern int sys_timer_get_information(u32 timer_id, mem_struct_ptr_t<sys_timer_information_t> info);
extern int sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info);
extern int sys_timer_start(u32 timer_id, s64 basetime, u64 period);
extern int sys_timer_stop(u32 timer_id);
extern int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2);
@ -299,7 +301,7 @@ extern int sys_trace_free_buffer();
extern int sys_trace_create2();
//sys_rwlock
extern int sys_rwlock_create(mem32_t rw_lock_id, mem_struct_ptr_t<sys_rwlock_attribute_t> attr);
extern int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr);
extern int sys_rwlock_destroy(u32 rw_lock_id);
extern int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout);
extern int sys_rwlock_tryrlock(u32 rw_lock_id);

View File

@ -174,7 +174,7 @@ int cellFsClosedir(u32 fd)
return CELL_OK;
}
int cellFsStat(const u32 path_addr, mem_struct_ptr_t<CellFsStat> sb)
int cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
{
const wxString& path = Memory.ReadString(path_addr);
sys_fs.Log("cellFsFstat(path: %s, sb_addr: 0x%x)", path, sb.GetAddr());
@ -216,7 +216,7 @@ int cellFsStat(const u32 path_addr, mem_struct_ptr_t<CellFsStat> sb)
return CELL_OK;
}
int cellFsFstat(u32 fd, mem_struct_ptr_t<CellFsStat> sb)
int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb)
{
sys_fs.Log("cellFsFstat(fd: %d, sb_addr: 0x%x)", fd, sb.GetAddr());
ID id;

View File

@ -77,6 +77,8 @@ int cellPadGetData(u32 port_no, u32 data_addr)
u16 d2 = 0;
const Array<Button>& buttons = pads[port_no].m_buttons;
pads[port_no].m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES;
s32 len = 0;
for(uint i=0; i<buttons.GetCount(); ++i)
{

View File

@ -4,7 +4,7 @@
SysCallBase sys_rwlock("sys_rwlock");
int sys_rwlock_create(mem32_t rw_lock_id, mem_struct_ptr_t<sys_rwlock_attribute_t> attr)
int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr)
{
sys_rwlock.Warning("Unimplemented function: sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr());
return CELL_OK;

View File

@ -1,40 +1,11 @@
#include "stdafx.h"
#include "SC_SPU_Thread.h"
#include "Emu/SysCalls/SysCalls.h"
#include "Loader/ELF.h"
#include "Emu/Cell/RawSPUThread.h"
SysCallBase sc_spu("sys_spu");
struct sys_spu_thread_group_attribute
{
u32 name_len;
u32 name_addr;
int type;
union{u32 ct;} option;
};
struct sys_spu_thread_attribute
{
u32 name_addr;
u32 name_len;
u32 option;
};
struct sys_spu_thread_argument
{
u64 arg1;
u64 arg2;
u64 arg3;
u64 arg4;
};
struct sys_spu_image
{
u32 type;
u32 entry_point;
u32 segs_addr;
int nsegs;
};
extern SysCallBase sys_event;
static const u32 g_spu_group_thr_count = 255;
@ -62,43 +33,38 @@ u32 LoadSpuImage(vfsStream& stream)
}
//156
int sys_spu_image_open(u32 img_addr, u32 path_addr)
int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
{
const wxString& path = Memory.ReadString(path_addr);
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img_addr, path_addr, path);
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path);
if(!Memory.IsGoodAddr(img_addr, sizeof(sys_spu_image)) || !Memory.IsGoodAddr(path_addr))
if(!img.IsGood() || !Memory.IsGoodAddr(path_addr))
{
return CELL_EFAULT;
}
vfsStream* stream = Emu.GetVFS().Open(path, vfsRead);
if(!stream || !stream->IsOpened())
vfsFile f(path);
if(!f.IsOpened())
{
sc_spu.Error("sys_spu_image_open error: '%s' not found!", path);
delete stream;
return CELL_ENOENT;
}
u32 entry = LoadSpuImage(*stream);
delete stream;
u32 entry = LoadSpuImage(f);
auto& ret = (sys_spu_image&)Memory[img_addr];
re(ret.type, 1);
re(ret.entry_point, entry);
re(ret.segs_addr, 0x0);
re(ret.nsegs, 0);
img->type = 1;
img->entry_point = entry;
img->segs_addr = 0x0;
img->nsegs = 0;
return CELL_OK;
}
//172
int sys_spu_thread_initialize(u32 thread_addr, u32 group, u32 spu_num, u32 img_addr, u32 attr_addr, u32 arg_addr)
int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg)
{
sc_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
thread_addr, group, spu_num, img_addr, attr_addr, arg_addr);
thread.GetAddr(), group, spu_num, img.GetAddr(), attr.GetAddr(), arg.GetAddr());
if(!Emu.GetIdManager().CheckID(group))
{
@ -107,19 +73,12 @@ int sys_spu_thread_initialize(u32 thread_addr, u32 group, u32 spu_num, u32 img_a
SpuGroupInfo& group_info = *(SpuGroupInfo*)Emu.GetIdManager().GetIDData(group).m_data;
if(
!Memory.IsGoodAddr(img_addr, sizeof(sys_spu_image)) ||
!Memory.IsGoodAddr(attr_addr, sizeof(sys_spu_thread_attribute)) ||
!Memory.IsGoodAddr(arg_addr, sizeof(sys_spu_thread_argument)))
if(!thread.IsGood() || !img.IsGood() || !attr.IsGood() || !attr.IsGood())
{
return CELL_EFAULT;
}
auto& img = (sys_spu_image&)Memory[img_addr];
auto& attr = (sys_spu_thread_attribute&)Memory[attr_addr];
auto& arg = (sys_spu_thread_argument&)Memory[arg_addr];
if(!Memory.IsGoodAddr(re(attr.name_addr), re(attr.name_len)))
if(!Memory.IsGoodAddr(attr->name_addr, attr->name_len))
{
return CELL_EFAULT;
}
@ -134,12 +93,12 @@ int sys_spu_thread_initialize(u32 thread_addr, u32 group, u32 spu_num, u32 img_a
return CELL_EBUSY;
}
u32 entry = re(img.entry_point);
wxString name = Memory.ReadString(re(attr.name_addr), re(attr.name_len));
u64 a1 = re(arg.arg1);
u64 a2 = re(arg.arg2);
u64 a3 = re(arg.arg3);
u64 a4 = re(arg.arg4);
u32 entry = img->entry_point;
wxString name = Memory.ReadString(attr->name_addr, attr->name_len);
u64 a1 = arg->arg1;
u64 a2 = arg->arg2;
u64 a3 = arg->arg3;
u64 a4 = arg->arg4;
ConLog.Write("New SPU Thread:");
ConLog.Write("entry = 0x%x", entry);
@ -161,15 +120,17 @@ int sys_spu_thread_initialize(u32 thread_addr, u32 group, u32 spu_num, u32 img_a
new_thread.SetArg(2, a3);
new_thread.SetArg(3, a4);
thread = new_thread.GetId();
group_info.threads[spu_num] = &new_thread;
return CELL_OK;
}
//166
int sys_spu_thread_set_argument(u32 id, u32 arg_addr)
int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
{
sc_spu.Warning("sys_spu_thread_set_argument(id=0x%x, arg_addr=0x%x)", id, arg_addr);
sc_spu.Warning("sys_spu_thread_set_argument(id=0x%x, 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))
@ -177,16 +138,15 @@ int sys_spu_thread_set_argument(u32 id, u32 arg_addr)
return CELL_ESRCH;
}
if(!Memory.IsGoodAddr(arg_addr, sizeof(sys_spu_thread_argument)))
if(!arg.IsGood())
{
return CELL_EFAULT;
}
auto& arg = (sys_spu_thread_argument&)Memory[arg_addr];
thr->SetArg(0, re(arg.arg1));
thr->SetArg(1, re(arg.arg2));
thr->SetArg(2, re(arg.arg3));
thr->SetArg(3, re(arg.arg4));
thr->SetArg(0, arg->arg1);
thr->SetArg(1, arg->arg2);
thr->SetArg(2, arg->arg3);
thr->SetArg(3, arg->arg4);
return CELL_OK;
}
@ -217,39 +177,39 @@ int sys_spu_thread_group_start(u32 id)
}
//170
int sys_spu_thread_group_create(u64 id_addr, u32 num, int prio, u64 attr_addr)
int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
{
ConLog.Write("sys_spu_thread_group_create:");
ConLog.Write("*** id_addr=0x%llx", id_addr);
ConLog.Write("*** id_addr=0x%x", id.GetAddr());
ConLog.Write("*** num=%d", num);
ConLog.Write("*** prio=%d", prio);
ConLog.Write("*** attr_addr=0x%llx", attr_addr);
ConLog.Write("*** attr_addr=0x%x", attr.GetAddr());
sys_spu_thread_group_attribute& attr = (sys_spu_thread_group_attribute&)Memory[attr_addr];
ConLog.Write("*** attr.name_len=%d", attr->name_len.ToLE());
ConLog.Write("*** attr.name_addr=0x%x", attr->name_addr.ToLE());
ConLog.Write("*** attr.type=%d", attr->type.ToLE());
ConLog.Write("*** attr.option.ct=%d", attr->option.ct.ToLE());
ConLog.Write("*** attr.name_len=%d", re(attr.name_len));
ConLog.Write("*** attr.name_addr=0x%x", re(attr.name_addr));
ConLog.Write("*** attr.type=%d", re(attr.type));
ConLog.Write("*** attr.option.ct=%d", re(attr.option.ct));
const wxString& name = Memory.ReadString(re(attr.name_addr), re(attr.name_len));
const wxString& name = Memory.ReadString(attr->name_addr, attr->name_len);
ConLog.Write("*** name='%s'", name);
Memory.Write32(id_addr,
Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(attr)));
id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(*attr));
return CELL_OK;
}
int sys_spu_thread_create(u64 thread_id_addr, u64 entry_addr, u64 arg,
int prio, u32 stacksize, u64 flags, u64 threadname_addr)
int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
{
UNIMPLEMENTED_FUNC(sc_spu);
return CELL_OK;
}
int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
{
if(!Emu.GetIdManager().CheckID(id))
sc_spu.Warning("sys_spu_thread_connect_event(id=0x%x,eq=0x%x,et=0x%x,spup=0x%x)", id, eq, et, spup);
EventQueue* equeue;
if(!sys_event.CheckId(eq, equeue))
{
return CELL_ESRCH;
}
@ -259,17 +219,33 @@ int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
return CELL_EINVAL;
}
return CELL_OK;
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
for(int j=0; j<equeue->pos; ++j)
{
if(!equeue->ports[j]->thread)
{
equeue->ports[j]->thread = thr;
return CELL_OK;
}
}
return CELL_EISCONN;
}
//160
int sys_raw_spu_create(u32 id_addr, u32 attr_addr)
int sys_raw_spu_create(mem32_t id, u32 attr_addr)
{
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id_addr, attr_addr);
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.GetAddr(), attr_addr);
//Emu.GetIdManager().GetNewID("sys_raw_spu", new u32(attr_addr));
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_RAW_SPU);
Memory.Write32(id_addr, ((RawSPUThread&)new_thread).GetIndex());
id = ((RawSPUThread&)new_thread).GetIndex();
new_thread.Run();
new_thread.Exec();
@ -316,10 +292,10 @@ int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
}
//182
int sys_spu_thread_read_ls(u32 id, u32 address, u32 value_addr, u32 type)
int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
{
sc_spu.Warning("sys_spu_thread_read_ls(id=0x%x, address=0x%x, value_addr=0x%x, type=0x%x)",
id, address, value_addr, type);
id, address, value.GetAddr(), type);
CPUThread* thr = Emu.GetCPU().GetThread(id);
@ -328,12 +304,12 @@ int sys_spu_thread_read_ls(u32 id, u32 address, u32 value_addr, u32 type)
return CELL_ESRCH;
}
if(!(*(SPUThread*)thr).IsGoodLSA(address))
if(!value.IsGood() || !(*(SPUThread*)thr).IsGoodLSA(address))
{
return CELL_EFAULT;
}
Memory.Write64(value_addr, (*(SPUThread*)thr).ReadLS64(address));
value = (*(SPUThread*)thr).ReadLS64(address);
return CELL_OK;
}
@ -359,14 +335,13 @@ int sys_spu_thread_write_spu_mb(u32 id, u32 value)
return CELL_OK;
}
extern SysCallBase sys_event;
int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 spup_addr)
{
sc_spu.Warning("sys_spu_thread_group_connect_event_all_threads(id=0x%x, eq=0x%x, req=0x%llx, spup_addr=0x%x)",
id, eq, req, spup_addr);
if(!Emu.GetIdManager().CheckID(id) || !sys_event.CheckId(eq))
EventQueue* equeue;
if(!Emu.GetIdManager().CheckID(id) || !sys_event.CheckId(eq, equeue))
{
return CELL_ESRCH;
}
@ -377,7 +352,6 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32
}
SpuGroupInfo* group = (SpuGroupInfo*)Emu.GetIdManager().GetIDData(id).m_data;
EventQueue* equeue = (EventQueue*)Emu.GetIdManager().GetIDData(eq).m_data;
for(int i=0; i<g_spu_group_thr_count; ++i)
{

View File

@ -0,0 +1,32 @@
#pragma once
struct sys_spu_thread_group_attribute
{
be_t<u32> name_len;
be_t<u32> name_addr;
be_t<int> type;
struct{be_t<u32> ct;} option;
};
struct sys_spu_thread_attribute
{
be_t<u32> name_addr;
be_t<u32> name_len;
be_t<u32> option;
};
struct sys_spu_thread_argument
{
be_t<u64> arg1;
be_t<u64> arg2;
be_t<u64> arg3;
be_t<u64> arg4;
};
struct sys_spu_image
{
be_t<u32> type;
be_t<u32> entry_point;
be_t<u32> segs_addr;
be_t<int> nsegs;
};

View File

@ -25,14 +25,14 @@ int sys_timer_destroy(u32 timer_id)
return CELL_OK;
}
int sys_timer_get_information(u32 timer_id, mem_struct_ptr_t<sys_timer_information_t> info)
int sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info)
{
sys_timer.Warning("sys_timer_get_information(timer_id=%d, info_addr=0x%x)", timer_id, info.GetAddr());
timer* timer_data = nullptr;
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH;
info = timer_data->timer_information_t;
*info = timer_data->timer_information_t;
return CELL_OK;
}

View File

@ -11,9 +11,8 @@ template<typename T> T max(const T a, const T b) { return a > b ? a : b; }
#define re32(val) MemoryBase::Reverse32(val)
#define re16(val) MemoryBase::Reverse16(val)
template<typename T> T re(const T val) { return MemoryBase::Reverse(val); }
template<typename T1, typename T2> void re(T1& dst, const T2 val) { dst = MemoryBase::Reverse<T1>(val); }
template<typename T> T re(const T val) { T res; se_t<T>::func(res, val); return res; }
template<typename T1, typename T2> void re(T1& dst, const T2 val) { se_t<T1>::func(dst, val); }
extern const wxEventType wxEVT_DBG_COMMAND;