cellAtrac draft

sys_spu_thread_group_resume
Some bugs fixed
This commit is contained in:
Nekotekina 2014-03-22 15:08:07 +04:00
parent 169fcd098b
commit d0ea397492
14 changed files with 113 additions and 45 deletions

View File

@ -58,7 +58,7 @@ void CPUThread::CloseStack()
{
if(m_stack_addr)
{
Memory.Free(m_stack_addr);
Memory.StackMem.Free(m_stack_addr);
m_stack_addr = 0;
}

View File

@ -210,6 +210,11 @@ bool DynamicMemoryBlockBase<PT>::Free(u64 addr)
}
}
ConLog.Error("DynamicMemoryBlock::Free(addr=0x%llx): failed", addr);
for (u32 i = 0; i < m_allocated.GetCount(); i++)
{
ConLog.Write("*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size);
}
return false;
}

View File

@ -64,7 +64,7 @@ next:
adec.reader.size = adec.task.au.size;
//ConLog.Write("Audio AU: size = 0x%x, pts = 0x%llx", adec.task.au.size, adec.task.au.pts);
if (adec.last_pts > adec.task.au.pts) adec.last_pts = adec.task.au.pts;
//if (adec.last_pts > adec.task.au.pts) adec.last_pts = adec.task.au.pts;
}
break;
default:
@ -266,7 +266,8 @@ u32 adecOpen(AudioDecoder* data)
adec.reader.size = task.au.size;
//ConLog.Write("Audio AU: size = 0x%x, pts = 0x%llx", task.au.size, task.au.pts);
if (adec.last_pts > task.au.pts || adec.just_started) adec.last_pts = task.au.pts;
//if (adec.last_pts > task.au.pts || adec.just_started) adec.last_pts = task.au.pts;
if (adec.just_started) adec.last_pts = task.au.pts;
struct AVPacketHolder : AVPacket
{

View File

@ -5,32 +5,7 @@
void cellAtrac_init();
Module cellAtrac(0x0013, cellAtrac_init);
// Return Codes
enum
{
CELL_ATRAC_OK = 0x00000000,
CELL_ATRAC_ERROR_API_FAIL = 0x80610301,
CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311,
CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312,
CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314,
CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315,
CELL_ATRAC_ERROR_NO_DECODER = 0x80610321,
CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322,
CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323,
CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331,
CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332,
CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333,
CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334,
CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341,
CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342,
CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351,
CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371,
CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372,
CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610381,
CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382,
};
#include "cellAtrac.h"
int cellAtracSetDataAndGetMemSize()
{
@ -58,13 +33,13 @@ int cellAtracDeleteDecoder()
int cellAtracDecode()
{
UNIMPLEMENTED_FUNC(cellAtrac);
//UNIMPLEMENTED_FUNC(cellAtrac);
return CELL_OK;
}
int cellAtracGetStreamDataInfo()
{
UNIMPLEMENTED_FUNC(cellAtrac);
//UNIMPLEMENTED_FUNC(cellAtrac);
return CELL_OK;
}

View File

@ -0,0 +1,28 @@
#pragma once
// Return Codes
enum
{
CELL_ATRAC_OK = 0x00000000,
CELL_ATRAC_ERROR_API_FAIL = 0x80610301,
CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311,
CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312,
CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314,
CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315,
CELL_ATRAC_ERROR_NO_DECODER = 0x80610321,
CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322,
CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323,
CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331,
CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332,
CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333,
CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334,
CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341,
CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342,
CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351,
CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371,
CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372,
CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610381,
CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382,
};

View File

@ -18,9 +18,9 @@ void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, const mem_ptr_t<CellCodecEsFi
const u32 esSpecificInfo_addr, mem_ptr_t<CellDmuxEsAttr> attr)
{
if (esFilterId->filterIdMajor >= 0xe0)
attr->memSize = 0x400000/2; // 0x45fa49 from ps3
attr->memSize = 0x500000; // 0x45fa49 from ps3
else
attr->memSize = 0x6000; // 0x73d9 from ps3
attr->memSize = 0x8000; // 0x73d9 from ps3
cellDmux.Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor,
(u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2);
@ -297,6 +297,7 @@ u32 dmuxOpen(Demuxer* data)
{
if (task.stream.discontinuity)
{
ConLog.Warning("dmuxSetStream (beginning)");
for (u32 i = 0; i < 192; i++)
{
if (esALL[i])
@ -649,7 +650,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize
int cellDmuxResetStream(u32 demuxerHandle)
{
cellDmux.Log("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle);
cellDmux.Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle);
Demuxer* dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -664,7 +665,7 @@ int cellDmuxResetStream(u32 demuxerHandle)
int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
{
cellDmux.Log("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle);
cellDmux.Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle);
Demuxer* dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -946,8 +947,6 @@ int cellDmuxReleaseAu(u32 esHandle)
{
cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle);
//return CELL_OK;
ElementaryStream* es;
if (!Emu.GetIdManager().GetIDData(esHandle, es))
{

View File

@ -19,6 +19,19 @@ enum
ConverterUnknown,
};
// detection result
enum
{
L10N_STR_UNKNOWN = (1 << 0),
L10N_STR_ASCII = (1 << 1),
L10N_STR_JIS = (1 << 2),
L10N_STR_EUCJP = (1 << 3),
L10N_STR_SJIS = (1 << 4),
L10N_STR_UTF8 = (1 << 5),
L10N_STR_ILLEGAL = (1 << 16),
L10N_STR_ERROR = (1 << 17),
};
int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t utf8_len)
{
cellL10n.Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
@ -43,6 +56,13 @@ int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t
return ConversionOK;
}
int jstrchk(mem8_ptr_t jstr)
{
cellL10n.Log("jstrchk(jstr_addr=0x%x [%s])", jstr.GetAddr(), "omitted" /*Memory.ReadString(jstr.GetAddr()).wx_str()*/);
return L10N_STR_UTF8;
}
void cellL10n_init()
{
// NOTE: I think this module should be LLE'd instead of implementing all its functions
@ -132,7 +152,7 @@ void cellL10n_init()
// cellL10n.AddFunc(0x73f2cd21, SJISstoJISs);
// cellL10n.AddFunc(0x74496718, SBCStoUTF8);
// cellL10n.AddFunc(0x74871fe0, UTF8toUTF32);
// cellL10n.AddFunc(0x750c363d, jstrchk);
cellL10n.AddFunc(0x750c363d, jstrchk);
// cellL10n.AddFunc(0x7c5bde1c, UHCtoEUCKR);
// cellL10n.AddFunc(0x7c912bda, kuten2jis);
// cellL10n.AddFunc(0x7d07a1c2, UTF8toEUCCN);

View File

@ -68,8 +68,8 @@ next:
vdec.reader.size = vdec.task.size;
//ConLog.Write("Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", vdec.task.size, vdec.task.pts, vdec.task.dts);
if (vdec.last_pts > vdec.task.pts) vdec.last_pts = vdec.task.pts;
if (vdec.last_dts > vdec.task.dts) vdec.last_dts = vdec.task.dts;
//if (vdec.last_pts > vdec.task.pts) vdec.last_pts = vdec.task.pts;
//if (vdec.last_dts > vdec.task.dts) vdec.last_dts = vdec.task.dts;
}
break;
default:
@ -208,8 +208,13 @@ u32 vdecOpen(VideoDecoder* data)
vdec.reader.size = task.size;
//ConLog.Write("Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", task.size, task.pts, task.dts);
if (vdec.last_pts > task.pts || vdec.just_started) vdec.last_pts = task.pts;
if (vdec.last_dts > task.dts || vdec.just_started) vdec.last_dts = task.dts;
//if (vdec.last_pts > task.pts || vdec.just_started) vdec.last_pts = task.pts;
//if (vdec.last_dts > task.dts || vdec.just_started) vdec.last_dts = task.dts;
if (vdec.just_started)
{
vdec.last_pts = task.pts;
vdec.last_dts = task.dts;
}
struct AVPacketHolder : AVPacket
{

View File

@ -106,7 +106,7 @@ static func_caller* sc_table[1024] =
bind_func(sys_spu_thread_get_exit_status), bind_func(sys_spu_thread_set_argument), null_func, null_func, bind_func(sys_spu_initialize), //169
bind_func(sys_spu_thread_group_create), bind_func(sys_spu_thread_group_destroy), bind_func(sys_spu_thread_initialize), //172
bind_func(sys_spu_thread_group_start), bind_func(sys_spu_thread_group_suspend), //174
null_func, null_func, null_func, bind_func(sys_spu_thread_group_join), null_func, //179
bind_func(sys_spu_thread_group_resume), null_func, null_func, bind_func(sys_spu_thread_group_join), null_func, //179
null_func, bind_func(sys_spu_thread_write_ls), bind_func(sys_spu_thread_read_ls), null_func, bind_func(sys_spu_thread_write_snr), //184
bind_func(sys_spu_thread_group_connect_event), bind_func(sys_spu_thread_group_disconnect_event), //186
bind_func(sys_spu_thread_set_spu_cfg), bind_func(sys_spu_thread_get_spu_cfg), null_func, //189

View File

@ -356,6 +356,7 @@ extern int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument
extern int sys_spu_thread_group_destroy(u32 id);
extern int sys_spu_thread_group_start(u32 id);
extern int sys_spu_thread_group_suspend(u32 id);
extern int sys_spu_thread_group_resume(u32 id);
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_group_join(u32 id, mem32_t cause, mem32_t status);

View File

@ -158,6 +158,9 @@ int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32
new_thread.SetStackSize(stacksize);
//new_thread.flags = flags;
new_thread.SetName(Memory.ReadString(threadname_addr).ToStdString());
ConLog.Write("*** New PPU Thread [%s] (): id = %d", wxString(new_thread.GetName()).wx_str(), new_thread.GetId());
new_thread.Run();
new_thread.Exec();
@ -177,7 +180,7 @@ void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry)
new_thread.Run();
new_thread.Exec();
GetCurrentPPUThread().Wait(new_thread);
//GetCurrentPPUThread().Wait(new_thread);
}
}

View File

@ -226,6 +226,8 @@ int sys_spu_thread_group_start(u32 id)
return CELL_ESRCH;
}
// TODO: check group state
for (u32 i = 0; i < group_info->list.GetCount(); i++)
{
CPUThread* t;
@ -249,7 +251,8 @@ int sys_spu_thread_group_suspend(u32 id)
return CELL_ESRCH;
}
//Emu.Pause();
// TODO: check group state
for (u32 i = 0; i < group_info->list.GetCount(); i++)
{
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
@ -261,6 +264,30 @@ int sys_spu_thread_group_suspend(u32 id)
return CELL_OK;
}
//175
int sys_spu_thread_group_resume(u32 id)
{
sc_spu.Log("sys_spu_thread_group_resume(id=%d)", id);
SpuGroupInfo* group_info;
if(!Emu.GetIdManager().GetIDData(id, group_info))
{
return CELL_ESRCH;
}
// TODO: check group state
for (u32 i = 0; i < group_info->list.GetCount(); i++)
{
if (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
{
t->Resume();
}
}
return CELL_OK;
}
//170
int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
{

View File

@ -286,6 +286,7 @@
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp" />
<ClCompile Include="Emu\SysCalls\Modules.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellAdec.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellAtrac.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellAudio.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellDmux.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellFont.cpp" />

View File

@ -475,6 +475,9 @@
<ClCompile Include="Emu\SysCalls\Modules\cellSaveData.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellAtrac.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="rpcs3.rc" />