From d2ca1cc25a2593f05a072e7cf816bb28457f45dc Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 2 Apr 2014 00:04:56 +0400 Subject: [PATCH] Audio sync fix Libmixer: SSPlayer draft Detection fixed Macros for function substitute registration --- rpcs3/Emu/SysCalls/Modules/cellAdec.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/libmixer.cpp | 357 +++++++++++++++--------- rpcs3/Emu/SysCalls/Modules/libmixer.h | 97 +++++++ rpcs3/Emu/SysCalls/Static.cpp | 8 +- rpcs3/Emu/SysCalls/SysCalls.h | 4 + 5 files changed, 338 insertions(+), 130 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index 4181430a47..8028b923a8 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -267,7 +267,7 @@ u32 adecOpen(AudioDecoder* data) if (adec.just_started) { adec.first_pts = task.au.pts; - adec.last_pts = task.au.pts /*- 3816*8*/; // hack + adec.last_pts = task.au.pts - 0x10000; // hack } struct AVPacketHolder : AVPacket diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index 48487f52ad..d57ce38a0f 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -18,23 +18,24 @@ u64 mixcount = 0; int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 samples) { - u32 ch = aan_port >> 16; + u32 type = aan_port >> 16; u32 port = aan_port & 0xffff; - switch (ch) + + switch (type) { - case 1: - if (port >= surMixer.chStrips1) ch = 0; break; - case 2: - if (port >= surMixer.chStrips2) ch = 0; break; - case 6: - /*if (port >= surMixer.chStrips6)*/ ch = 0; break; - case 8: - if (port >= surMixer.chStrips8) ch = 0; break; + case CELL_SURMIXER_CHSTRIP_TYPE1A: + if (port >= surMixer.chStrips1) type = 0; break; + case CELL_SURMIXER_CHSTRIP_TYPE2A: + if (port >= surMixer.chStrips2) type = 0; break; + case CELL_SURMIXER_CHSTRIP_TYPE6A: + if (port >= surMixer.chStrips6) type = 0; break; + case CELL_SURMIXER_CHSTRIP_TYPE8A: + if (port >= surMixer.chStrips8) type = 0; break; default: - ch = 0; break; + type = 0; break; } - if (aan_handle == 0x11111111 && samples == 256 && ch && offset == 0) + if (aan_handle == 0x11111111 && samples == 256 && type && offset == 0) { libmixer.Log("cellAANAddData(handle=0x%x, port=0x%x, offset=0x%x, addr=0x%x, samples=0x%x)", aan_handle, aan_port, offset, addr, samples); @@ -49,7 +50,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl SMutexLocker lock(mixer_mutex); - if (ch == 1) + if (type == CELL_SURMIXER_CHSTRIP_TYPE1A) { // mono upmixing for (u32 i = 0; i < samples; i++) @@ -59,7 +60,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl mixdata[i*8+1] += center; } } - else if (ch == 2) + else if (type == CELL_SURMIXER_CHSTRIP_TYPE2A) { // stereo upmixing for (u32 i = 0; i < samples; i++) @@ -70,7 +71,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl mixdata[i*8+1] += right; } } - else if (ch == 6) + else if (type == CELL_SURMIXER_CHSTRIP_TYPE6A) { // 5.1 upmixing for (u32 i = 0; i < samples; i++) @@ -89,7 +90,7 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl mixdata[i*8+5] += rear_right; } } - else if (ch == 8) + else if (type == CELL_SURMIXER_CHSTRIP_TYPE8A) { // 7.1 for (u32 i = 0; i < samples * 8; i++) @@ -103,59 +104,61 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl int cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) { - libmixer.Error("cellAANConnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcrPortNo=0x%x)", + libmixer.Error("cellAANConnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); - return 0; + return CELL_OK; } int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) { - libmixer.Error("cellAANDisconnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcrPortNo=0x%x)", + libmixer.Error("cellAANDisconnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); - return 0; + return CELL_OK; } -/*int cellSSPlayerCreate(CellAANHandle *handle, CellSSPlayerConfig *config) +int cellSSPlayerCreate(mem32_t handle, mem_ptr_t config) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)", + handle.GetAddr(), config.GetAddr()); + return CELL_OK; } -int cellSSPlayerRemove(CellAANHandle handle) +int cellSSPlayerRemove(u32 handle) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerRemove(handle=%d)", handle); + return CELL_OK; } -int cellSSPlayerSetWave() //CellAANHandle handle, CellSSPlayerWaveParam *waveInfo, CellSSPlayerCommonParam *commonInfo //mem_class_t waveInfo +int cellSSPlayerSetWave(u32 handle, mem_ptr_t waveInfo, mem_ptr_t commonInfo) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)", + handle, waveInfo.GetAddr(), commonInfo.GetAddr()); + return CELL_OK; } -int cellSSPlayerPlay() //CellAANHandle handle, CellSSPlayerRuntimeInfo *info +int cellSSPlayerPlay(u32 handle, mem_ptr_t info) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); + return CELL_OK; } -int cellSSPlayerStop() //CellAANHandle handle, u32 mode +int cellSSPlayerStop(u32 handle, u32 mode) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerStop(handle=%d, mode=0x%x)", handle, mode); + return CELL_OK; } -int cellSSPlayerSetParam() //CellAANHandle handle, CellSSPlayerRuntimeInfo *info +int cellSSPlayerSetParam(u32 handle, mem_ptr_t info) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; + libmixer.Error("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); + return CELL_OK; } -s32 cellSSPlayerGetState() //CellAANHandle handle +s32 cellSSPlayerGetState(u32 handle) { - UNIMPLEMENTED_FUNC(libmixer); - return 0; -}*/ + libmixer.Error("cellSSPlayerGetState(handle=%d) -> OFF", handle); + return CELL_SSPLAYER_STATE_OFF; +} int cellSurMixerCreate(const mem_ptr_t config) { @@ -376,7 +379,7 @@ void cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) void libmixer_init() { - static const u64 cellAANAddData_table[] = { + REG_SUB(libmixer, "surmxAAN", cellAANAddData, 0xffffffff7c691b78, 0xffffffff7c0802a6, 0xfffffffff821ff91, @@ -400,11 +403,9 @@ void libmixer_init() 0xffffffff7c0803a6, 0xffffffff38210070, 0xffffffff4e800020, - 0 - }; - libmixer.AddFuncSub("surmxAAN", cellAANAddData_table, "cellAANAddData", cellAANAddData); + ); - static const u64 cellAANConnect_table[] = { + REG_SUB(libmixer, "surmxAAN", cellAANConnect, 0xfffffffff821ff71, 0xffffffff7c0802a6, 0xffffffff2f830000, @@ -443,11 +444,9 @@ void libmixer_init() 0xffffffff38210090, 0xffffffff7c0803a6, 0xffffffff4e800020, - 0, - }; - libmixer.AddFuncSub("surmxAAN", cellAANConnect_table, "cellAANConnect", cellAANConnect); + ); - static const u64 cellAANDisconnect_table[] = { + REG_SUB(libmixer, "surmxAAN", cellAANDisconnect, 0xfffffffff821ff71, 0xffffffff7c0802a6, 0xffffffff2f830000, @@ -486,11 +485,9 @@ void libmixer_init() 0xffffffff38210090, 0xffffffff7c0803a6, 0xffffffff4e800020, - 0, - }; - libmixer.AddFuncSub("surmxAAN", cellAANDisconnect_table, "cellAANDisconnect", cellAANDisconnect); + ); - static const u64 cellSurMixerCreate_table[] = { + REG_SUB(libmixer, "surmixer", cellSurMixerCreate, 0xffffffff2f830000, 0xffffffff7c0802a6, 0xfffffffff821ff51, @@ -517,12 +514,10 @@ void libmixer_init() 0xffffffffebc100a0, 0xffffffffebe100a8, 0xffffffff382100b0, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerCreate_table, "cellSurMixerCreate", cellSurMixerCreate); + ); - static const u64 cellSurMixerGetAANHandle_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerGetAANHandle, + 0xff00000081428250, // lwz 0xffffffff3d607fce, 0xffffffff616bfffe, 0xffffffff812a0018, @@ -536,12 +531,10 @@ void libmixer_init() 0xffffffff38630002, 0xffffffff7c6307b4, 0xffffffff4e800020, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerGetAANHandle_table, "cellSurMixerGetAANHandle", cellSurMixerGetAANHandle); + ); - static const u64 cellSurMixerChStripGetAANPortNo_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerChStripGetAANPortNo, + 0xff00000081228250, // lwz 0xffffffff7c661b78, 0xffffffff3c608031, 0xffffffff78c60020, @@ -553,12 +546,10 @@ void libmixer_init() 0xffffffff4d9e0020, 0xffffffff78030020, 0xf000000040000000, // b - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerChStripGetAANPortNo_table, "cellSurMixerChStripGetAANPortNo", cellSurMixerChStripGetAANPortNo); + ); - static const u64 cellSurMixerSetNotifyCallback_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerSetNotifyCallback, + 0xff00000081428250, // lwz 0xffffffff7c0802a6, 0xfffffffff821ff81, 0xfffffffff8010090, @@ -583,12 +574,10 @@ void libmixer_init() 0xffffffff38810070, 0xffffffff2f800000, 0xffffffff7d234b78, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerSetNotifyCallback_table, "cellSurMixerSetNotifyCallback", cellSurMixerSetNotifyCallback); + ); - static const u64 cellSurMixerRemoveNotifyCallback_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerRemoveNotifyCallback, + 0xff00000081628250, // lwz 0xffffffff7c0802a6, 0xfffffffff821ff81, 0xfffffffff8010090, @@ -603,11 +592,9 @@ void libmixer_init() 0xffffffff38210080, 0xffffffff7c0803a6, 0xffffffff4e800020, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerRemoveNotifyCallback_table, "cellSurMixerRemoveNotifyCallback", cellSurMixerRemoveNotifyCallback); + ); - static const u64 cellSurMixerStart_table[] = { + REG_SUB(libmixer, "surmixer", cellSurMixerStart, 0xfffffffff821ff71, 0xffffffff7c0802a6, 0xfffffffffbc10080, @@ -628,11 +615,9 @@ void libmixer_init() 0xffffffffebe10088, 0xffffffff38210090, 0xffffffff4e800020, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerStart_table, "cellSurMixerStart", cellSurMixerStart); + ); - static const u64 cellSurMixerSetParameter_table[] = { + REG_SUB(libmixer, "surmixer", cellSurMixerSetParameter, 0xfffffffff821ff81, 0xffffffff7c0802a6, 0xfffffffffbc10070, @@ -660,11 +645,9 @@ void libmixer_init() 0xffffffff2b83002b, 0xffff000040990008, // ble 0xffff0000409d0054, // ble - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerSetParameter_table, "cellSurMixerSetParameter", cellSurMixerSetParameter); + ); - static const u64 cellSurMixerFinalize_table[] = { + REG_SUB(libmixer, "surmixer", cellSurMixerFinalize, 0xfffffffff821ff91, 0xffffffff7c0802a6, 0xfffffffff8010080, @@ -688,12 +671,10 @@ void libmixer_init() 0xffffffff7c0903a6, 0xffffffff804a0004, 0xffffffff4e800421, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerFinalize_table, "cellSurMixerFinalize", cellSurMixerFinalize); + ); - static const u64 cellSurMixerSurBusAddData_table[] = { - 0xff00000081428250, + REG_SUB(libmixer, "surmixer", cellSurMixerSurBusAddData, + 0xff00000081428250, // lwz 0xffffffff7c0802a6, 0xfffffffff821ff91, 0xfffffffff8010080, @@ -719,12 +700,10 @@ void libmixer_init() 0xffffffff79660020, 0xffffffff78e70020, 0xffff0000419cffcc, // blt - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerSurBusAddData_table, "cellSurMixerSurBusAddData", cellSurMixerSurBusAddData); + ); - static const u64 cellSurMixerChStripSetParameter_table[] = { - 0xff00000081028250, + REG_SUB(libmixer, "surmixer", cellSurMixerChStripSetParameter, + 0xff00000081028250, // lwz 0xffffffff7c6b1b78, 0xffffffff3c608031, 0xffffffff7c8a2378, @@ -741,12 +720,10 @@ void libmixer_init() 0xffffffff4d9c0020, 0xffffffff79230020, 0xf000000048000000, // b - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerChStripSetParameter_table, "cellSurMixerChStripSetParameter", cellSurMixerChStripSetParameter); + ); - static const u64 cellSurMixerPause_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerPause, + 0xff00000081428250, // lwz 0xffffffff7c0802a6, 0xfffffffff821ff81, 0xfffffffff8010090, @@ -768,12 +745,10 @@ void libmixer_init() 0xffffffff800a001c, 0xffffffff2b030002, 0xffffffff2f800000, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerPause_table, "cellSurMixerPause", cellSurMixerPause); + ); - static const u64 cellSurMixerGetCurrentBlockTag_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerGetCurrentBlockTag, + 0xff00000081628250, // lwz 0xffffffff3d208031, 0xffffffff61290002, 0xffffffff880b0020, @@ -784,12 +759,10 @@ void libmixer_init() 0xfffffffff8030000, 0xffffffff7d2307b4, 0xffffffff4e800020, - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerGetCurrentBlockTag_table, "cellSurMixerGetCurrentBlockTag", cellSurMixerGetCurrentBlockTag); + ); - static const u64 cellSurMixerGetTimestamp_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerGetTimestamp, + 0xff00000081628250, // lwz 0xffffffff7c0802a6, 0xfffffffff821ff91, 0xfffffffff8010080, @@ -808,12 +781,10 @@ void libmixer_init() 0xffffffff4e800020, 0xffffffff806b04d8, 0xf000000048000001, // bl - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerGetTimestamp_table, "cellSurMixerGetTimestamp", cellSurMixerGetTimestamp); + ); - static const u64 cellSurMixerBeep_table[] = { - // first instruction ignored + REG_SUB(libmixer, "surmixer", cellSurMixerBeep, + 0xff00000081228250, // lwz 0xffffffff7c641b78, 0xffffffff80690018, 0xffffffff2f830000, @@ -824,13 +795,149 @@ void libmixer_init() 0xffffffff2f800000, 0xffffffff4d9c0020, 0xf000000048000000, // b - 0 - }; - libmixer.AddFuncSub("surmx___", cellSurMixerBeep_table, "cellSurMixerBeep", cellSurMixerBeep); + ); - // TODO: SSPlayer functions - /*static const u64 cell_table[] = { - 0 - }; - libmixer.AddFuncSub("surmxSSP", cell_table, "cell", nullptr);*/ + REG_SUB(libmixer, "surmxSSP", cellSSPlayerCreate, + 0xfffffffff821ff51, + 0xffffffff7c0802a6, + 0xffffffff2f840000, + 0xfffffffff80100c0, + 0xffffffff3c008031, + 0xfffffffffb210078, + 0xfffffffffb410080, + 0xfffffffffb610088, + 0xfffffffffb810090, + 0xfffffffffba10098, + 0xfffffffffbc100a0, + 0xfffffffffbe100a8, + 0xffffffff7c9a2378, + 0xffffffff7c791b78, + 0xffffffff60000003, + 0xffff0000419e0068, // beq + 0xff00000083620000, // lwz + 0xffffffff3b800000, + 0xffffffff381b0064, + 0xffffffff901b0018, + 0xffffffff5780103a, + 0xffffffff38800010, + 0xffffffff7c0007b4, + 0xffffffff38a01c70, + 0xffffffff7fc0da14, + 0xffffffff38c00000, + 0xffffffff83be0024, + 0xffffffff2f9d0000, + 0xffffffff7ba30020, + 0xffff000041de00c0, // beq- + 0xf000000048000001, // bl + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerRemove, + 0xffffffff7c641b78, + 0xffffffff7c0802a6, + 0xffffffff3c608031, + 0xffffffff2f840000, + 0xfffffffff821ff51, + 0xfffffffffb010070, + 0xfffffffffb210078, + 0xfffffffffb410080, + 0xfffffffffb610088, + 0xfffffffffb810090, + 0xfffffffffba10098, + 0xfffffffffbc100a0, + 0xfffffffffbe100a8, + 0xfffffffff80100c0, + 0xffffffff60630003, + 0xffff0000419e0074, // beq + 0xffffffff81240000, + 0xffffffff78830020, + 0xffffffff83440004, + 0xffffffff83240008, + 0xffffffff7b5b0020, + 0xffffffff81690000, + 0xffffffff800b0000, + 0xfffffffff8410028, + 0xffffffff7c0903a6, + 0xffffffff804b0004, + 0xffffffff4e800421, + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerSetWave, + 0xffffffff7c601b78, + 0xffffffff78840020, + 0xffffffff2f800000, + 0xffffffff3c608031, + 0xffffffff78a50020, + 0xffff0000419e000c, // beq + 0xffffffff78030020, + 0xf000000048000000, // b + 0xffffffff60630003, + 0xffffffff4e800020, + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerPlay, + 0xffffffff7c601b78, + 0xffffffff3c608031, + 0xffffffff2f800000, + 0xffffffff60630003, + 0xffffffff78840020, + 0xffffffff4d9e0020, + 0xffffffff78030020, + 0xf000000048000000, // b + 0xfffffffff821ff81, // next func + 0xffffffff7c0802a6, + 0xfffffffffbe10078, + 0xffffffff7c7f1b78, + 0xff00000081620028, // lwz + 0xfffffffff8010090, + 0xffffffff39400000, + 0xffffffff38630010, + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerStop, + 0xfffffffff821ff91, + 0xffffffff7c0802a6, + 0xffffffff2f830000, + 0xfffffffff8010080, + 0xffffffff3c008031, + 0xffffffff78630020, + 0xffffffff60000003, + 0xffff0000419e0010, // beq + 0xffffffff78840020, + 0xf000000048000001, // bl + 0xffffffff38000000, + 0xffffffff7c0307b4, + 0xffffffffe8010080, + 0xffffffff38210070, + 0xffffffff7c0803a6, + 0xffffffff4e800020, + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerSetParam, + 0xffffffff7c601b78, + 0xffffffff3c608031, + 0xffffffff2f800000, + 0xffffffff60630003, + 0xffffffff78840020, + 0xffffffff4d9e0020, + 0xffffffff78030020, + 0xf000000048000000, // b + 0xfffffffff821ff71, // next func + 0xffffffff7c0802a6, + 0xffffffff3d608031, + 0xfffffffff80100a0, + 0xffffffff80030068, + 0xffffffff616b0002, + 0xfffffffffbc10080, + 0xffffffff2f800000, + ); + + REG_SUB(libmixer, "surmxSSP", cellSSPlayerGetState, + 0xffffffff7c601b78, + 0xffffffff3c608031, + 0xffffffff2f800000, + 0xffffffff60630003, + 0xffffffff4d9e0020, + 0xffffffff78030020, + 0xf000000048000000, // b + ); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.h b/rpcs3/Emu/SysCalls/Modules/libmixer.h index 590e6e2110..3512634e0d 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.h +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.h @@ -13,6 +13,103 @@ enum CELL_LIBMIXER_ERROR_NOT_FOUND = 0x8031000a, }; +enum +{ + CELL_SURBUS_LEFT = 0, + CELL_SURBUS_RIGHT = 1, + CELL_SURBUS_CENTER = 2, + CELL_SURBUS_LFE = 3, + CELL_SURBUS_LEFT_SUR = 4, + CELL_SURBUS_RIGHT_SUR = 5, + CELL_SURBUS_LEFT_EXT = 6, + CELL_SURBUS_RIGHT_EXT = 7, + CELL_SURBUS_REVERB_LEFT = 8, + CELL_SURBUS_REVERB_RIGHT = 9, + CELL_SURBUS_REVERB_LEFT_SUR = 10, + CELL_SURBUS_REVERB_RIGHT_SUR = 11, +}; + +enum +{ + CELL_SURMIXER_PARAM_TOTALLEVEL_LINEAR = 8, + CELL_SURMIXER_PARAM_REVERBLEVEL_LINEAR = 9, + CELL_SURMIXER_PARAM_TOTALMUTE = 12, + + CELL_SURMIXER_PARAM_TOTALLEVEL = 40, // in dB + CELL_SURMIXER_PARAM_REVERBLEVEL = 41, // in dB +}; + +static const float CELL_SURMIXER_CONT_MUTEON = 1.0; +static const float CELL_SURMIXER_CONT_MUTEOFF = 0.0; + +enum +{ + CELL_SURMIXER_CONT_DBSWITCHON = 1, + CELL_SURMIXER_CONT_DBSWITCHOFF = 0, + CELL_SURMIXER_CONT_PAUSE_OFF = 0, + CELL_SURMIXER_CONT_PAUSE_ON = 1, + CELL_SURMIXER_CONT_PAUSE_ON_IMMEDIATE = 2, +}; + +enum +{ + CELL_SURMIXER_CHSTRIP_TYPE1A = 1, + CELL_SURMIXER_CHSTRIP_TYPE2A = 2, + CELL_SURMIXER_CHSTRIP_TYPE6A = 3, + CELL_SURMIXER_CHSTRIP_TYPE8A = 4, + + CELL_SURMIXER_CH1PARAM_LEVEL = 0, + CELL_SURMIXER_CH1PARAM_EXPRESSIONLEVEL = 1, + CELL_SURMIXER_CH1PARAM_CENTERLEVEL = 2, + CELL_SURMIXER_CH1PARAM_REVERBSENDLEVEL = 3, + CELL_SURMIXER_CH1PARAM_MUTE = 4, + CELL_SURMIXER_CH1PARAM_REVSENDPOSITION = 5, + CELL_SURMIXER_CH1PARAM_POSITION = 6, + + CELL_SURMIXER_CH2PARAM_LEVEL = 0, + CELL_SURMIXER_CH2PARAM_EXPRESSIONLEVEL = 1, + CELL_SURMIXER_CH2PARAM_CENTERLEVEL = 2, + CELL_SURMIXER_CH2PARAM_REVERBSENDLEVEL = 3, + CELL_SURMIXER_CH2PARAM_MUTE = 4, + CELL_SURMIXER_CH2PARAM_REVSENDPOSITION = 5, + CELL_SURMIXER_CH2PARAM_POSITION = 6, + + CELL_SURMIXER_CH6PARAM_LEVEL = 0, + CELL_SURMIXER_CH6PARAM_EXPRESSIONLEVEL = 1, + CELL_SURMIXER_CH6PARAM_REVERBSENDLEVEL = 2, + CELL_SURMIXER_CH6PARAM_CENTER_REVERBSENDLEVEL = 3, + CELL_SURMIXER_CH6PARAM_MUTE = 4, + + CELL_SURMIXER_CH8PARAM_LEVEL = 0, + CELL_SURMIXER_CH8PARAM_EXPRESSIONLEVEL = 1, + CELL_SURMIXER_CH8PARAM_REVERBSENDLEVEL = 2, + CELL_SURMIXER_CH8PARAM_CENTER_REVERBSENDLEVEL = 3, + CELL_SURMIXER_CH8PARAM_MUTE = 4, + + CELL_SURMIXER_CH1CONT_MUTE_OFF = 0, + CELL_SURMIXER_CH1CONT_MUTE_ON = 1, + CELL_SURMIXER_CH2CONT_MUTE_OFF = 0, + CELL_SURMIXER_CH2CONT_MUTE_ON = 1, + CELL_SURMIXER_CH6CONT_MUTE_OFF = 0, + CELL_SURMIXER_CH6CONT_MUTE_ON = 1, + CELL_SURMIXER_CH8CONT_MUTE_OFF = 0, + CELL_SURMIXER_CH8CONT_MUTE_ON = 1, +}; + +enum +{ + CELL_SSPLAYER_ONESHOT = 0, + CELL_SSPLAYER_ONESHOT_CONT = 2, + CELL_SSPLAYER_LOOP_ON = 16, + + CELL_SSPLAYER_STATE_ERROR = 0xffffffff, + CELL_SSPLAYER_STATE_NOTREADY = 0x88888888, + CELL_SSPLAYER_STATE_OFF = 0x00, + CELL_SSPLAYER_STATE_PAUSE = 0x01, + CELL_SSPLAYER_STATE_CLOSING = 0x08, + CELL_SSPLAYER_STATE_ON = 0x20, +}; + typedef int (*CellSurMixerNotifyCallbackFunction)(void *arg, u32 counter, u32 samples); struct CellSSPlayerConfig diff --git a/rpcs3/Emu/SysCalls/Static.cpp b/rpcs3/Emu/SysCalls/Static.cpp index 073bf0dad5..7a26f9255e 100644 --- a/rpcs3/Emu/SysCalls/Static.cpp +++ b/rpcs3/Emu/SysCalls/Static.cpp @@ -110,14 +110,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) u32 res = GSR_SUCCESS; // analyse - for (u32 j = i; j < g_static_funcs_list.GetCount(); j++) if (g_static_funcs_list[j].group == group) + for (u32 j = 0; j < g_static_funcs_list.GetCount(); j++) if (g_static_funcs_list[j].group == group) { u32 count = g_static_funcs_list[j].found; if (count == 0) // not found { // check if this function has been found with different pattern - for (u32 k = i; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group) + for (u32 k = 0; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group) { if (k != j && g_static_funcs_list[k].ptr == g_static_funcs_list[j].ptr) { @@ -137,7 +137,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) else if (count == 1) // found { // ensure that this function has NOT been found with different pattern - for (u32 k = i; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group) + for (u32 k = 0; k < g_static_funcs_list.GetCount(); k++) if (g_static_funcs_list[k].group == group) { if (k != j && g_static_funcs_list[k].ptr == g_static_funcs_list[j].ptr) { @@ -157,7 +157,7 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) } // clear data - for (u32 j = i; j < g_static_funcs_list.GetCount(); j++) + for (u32 j = 0; j < g_static_funcs_list.GetCount(); j++) { if (g_static_funcs_list[j].group == group) g_static_funcs_list[j].found = 0; } diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 1050d00892..8148074d83 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -467,3 +467,7 @@ public: void StaticAnalyse(void* ptr, u32 size, u32 base); void StaticExecute(u32 code); void StaticFinalize(); + +#define REG_SUB(module, group, name,...) \ + static const u64 name ## _table[] = {__VA_ARGS__ ## 0}; \ + module.AddFuncSub(group, name ## _table, #name, name) \ No newline at end of file