mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Event system rewriting, EventManager partially implemented
cellAudio partially rewritten, some bugs fixed
This commit is contained in:
parent
8adf19c904
commit
460d948e87
28 changed files with 1228 additions and 476 deletions
|
@ -156,7 +156,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
|||
//166
|
||||
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.GetAddr());
|
||||
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))
|
||||
|
@ -180,7 +180,7 @@ int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
|||
//165
|
||||
int sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_exit_status(id=0x%x, status_addr=0x%x)", id, status.GetAddr());
|
||||
sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
|
||||
|
||||
if (!status.IsGood())
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ int sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
|||
//171
|
||||
int sys_spu_thread_group_destroy(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_destroy(id=0x%x)", id);
|
||||
sc_spu.Warning("sys_spu_thread_group_destroy(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
|
@ -232,7 +232,7 @@ int sys_spu_thread_group_destroy(u32 id)
|
|||
//173
|
||||
int sys_spu_thread_group_start(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_start(id=0x%x)", id);
|
||||
sc_spu.Warning("sys_spu_thread_group_start(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
|
@ -255,7 +255,7 @@ int sys_spu_thread_group_start(u32 id)
|
|||
//174
|
||||
int sys_spu_thread_group_suspend(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_suspend(id=0x%x)", id);
|
||||
sc_spu.Warning("sys_spu_thread_group_suspend(id=%d)", id);
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
|
@ -293,7 +293,7 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
|||
|
||||
id = sc_spu.GetNewId(new SpuGroupInfo(name, num, prio, attr->type, attr->ct));
|
||||
|
||||
sc_spu.Warning("*** SPU Thread Group created [%s] (type=%d, option.ct=%d): id=%d",
|
||||
sc_spu.Warning("*** SPU Thread Group created [%s] (type=0x%x, option.ct=0x%x): id=%d",
|
||||
name.c_str(), (int)attr->type, (u32)attr->ct, id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
|
@ -302,7 +302,7 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
|||
//178
|
||||
int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_join(id=0x%x, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
|
||||
sc_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
|
||||
|
||||
SpuGroupInfo* group_info;
|
||||
if(!Emu.GetIdManager().GetIDData(id, group_info))
|
||||
|
@ -326,7 +326,11 @@ int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
|||
{
|
||||
break;
|
||||
}
|
||||
if (Emu.IsStopped()) return CELL_OK;
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
ConLog.Warning("sys_spu_thread_group_join(id=%d, ...) aborted", id);
|
||||
return CELL_OK;
|
||||
}
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
@ -342,40 +346,6 @@ int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if(spup > 63)
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
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(mem32_t id, u32 attr_addr)
|
||||
{
|
||||
|
@ -414,7 +384,7 @@ int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
|||
//181
|
||||
int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_write_ls(id=0x%x, address=0x%x, value=0x%llx, type=0x%x)",
|
||||
sc_spu.Warning("sys_spu_thread_write_ls(id=%d, address=0x%x, value=0x%llx, type=0x%x)",
|
||||
id, address, value, type);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
@ -424,15 +394,30 @@ int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
(*(SPUThread*)thr).WriteLS64(address, value);
|
||||
if (!thr->IsRunning())
|
||||
{
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 1: (*(SPUThread*)thr).WriteLS8(address, value); return CELL_OK;
|
||||
case 2: (*(SPUThread*)thr).WriteLS16(address, value); return CELL_OK;
|
||||
case 4: (*(SPUThread*)thr).WriteLS32(address, value); return CELL_OK;
|
||||
case 8: (*(SPUThread*)thr).WriteLS64(address, value); return CELL_OK;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
//182
|
||||
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)",
|
||||
sc_spu.Warning("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
|
||||
id, address, value.GetAddr(), type);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
@ -442,20 +427,35 @@ int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if(!value.IsGood() || !(*(SPUThread*)thr).IsGoodLSA(address))
|
||||
if (!thr->IsRunning())
|
||||
{
|
||||
return CELL_ESTAT;
|
||||
}
|
||||
|
||||
if(!value.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
value = (*(SPUThread*)thr).ReadLS64(address);
|
||||
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
switch (type)
|
||||
{
|
||||
case 1: value = (*(SPUThread*)thr).ReadLS8(address); return CELL_OK;
|
||||
case 2: value = (*(SPUThread*)thr).ReadLS16(address); return CELL_OK;
|
||||
case 4: value = (*(SPUThread*)thr).ReadLS32(address); return CELL_OK;
|
||||
case 8: value = (*(SPUThread*)thr).ReadLS64(address); return CELL_OK;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
//190
|
||||
int sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_write_spu_mb(id=0x%x, value=0x%x)", id, value);
|
||||
sc_spu.Warning("sys_spu_thread_write_spu_mb(id=%d, value=0x%x)", id, value);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
|
@ -464,11 +464,7 @@ int sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if(!(*(SPUThread*)thr).SPU.In_MBox.Push(value))
|
||||
{
|
||||
ConLog.Warning("sys_spu_thread_write_spu_mb(id=0x%x, value=0x%x): used all mbox items.");
|
||||
return CELL_EBUSY; //?
|
||||
}
|
||||
(*(SPUThread*)thr).SPU.In_MBox.PushUncond(value);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -476,7 +472,7 @@ int sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
|||
//187
|
||||
int sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_set_spu_cfg(id=0x%x, value=0x%x)", id, value);
|
||||
sc_spu.Warning("sys_spu_thread_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
|
@ -498,7 +494,7 @@ int sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
|||
//188
|
||||
int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_spu_cfg(id=0x%x, value_addr=0x%x)", id, value.GetAddr());
|
||||
sc_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
||||
|
@ -515,7 +511,7 @@ int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
|||
//184
|
||||
int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_snr(id=0x%x, number=%d, value=0x%x)", id, number, 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))
|
||||
|
@ -540,9 +536,23 @@ int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
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)",
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event_all_threads(id=%d, eq=%d, req=0x%llx, spup_addr=0x%x)",
|
||||
id, eq, req, spup_addr);
|
||||
|
||||
EventQueue* equeue;
|
||||
|
@ -562,6 +572,7 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
/*
|
||||
for(u32 i=0; i<group->list.GetCount(); ++i)
|
||||
{
|
||||
CPUThread* t;
|
||||
|
@ -582,13 +593,79 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32
|
|||
return CELL_EISCONN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num)
|
||||
int sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_bind_queue(id=0x%x, spuq=0x%x, spuq_num=0x%x)", id, spuq, spuq_num);
|
||||
sc_spu.Error("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_connect_event(id=%d, eq=%d, et=0x%x, spup=%d)", id, eq, et, spup);
|
||||
|
||||
EventQueue* equeue;
|
||||
if(!sys_event.CheckId(eq, equeue))
|
||||
{
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if(spup > 63)
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
int sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_disconnect_event(id=%d, event_type=0x%x, spup=%d", id, event_type, spup);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
SPU-Side functions:
|
||||
int sys_spu_thread_receive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
int sys_spu_thread_send_event(u8 spup, u24 data0, u32 data1);
|
||||
int sys_spu_thread_throw_event(u8 spup, u24 data0, u32 data1);
|
||||
int sys_spu_thread_tryreceive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
*/
|
||||
|
||||
int sys_spu_thread_bind_queue(u32 id, u32 equeue_id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_bind_queue(id=%d, equeue_id=%d, spuq_num=%d)", id, equeue_id, spuq_num);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_unbind_queue(id=0x%x, spuq_num=%d)", id, spuq_num);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue