From b6d8f1e0280b8592e8c0cbc56c09be3e53d044a1 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Wed, 2 Apr 2014 19:17:43 +0400 Subject: [PATCH] Small fix (cellAudio, fsAioRead) libsynth2 draft --- rpcs3/Emu/Audio/cellAudio.h | 16 --- rpcs3/Emu/SysCalls/Modules/cellAudio.cpp | 120 +---------------- rpcs3/Emu/SysCalls/Modules/libmixer.cpp | 4 + rpcs3/Emu/SysCalls/Modules/libsynth2.cpp | 159 +++++++++++++++++++++++ rpcs3/Emu/SysCalls/Modules/libsynth2.h | 19 +++ rpcs3/Emu/SysCalls/Modules/sys_fs.cpp | 9 -- rpcs3/rpcs3.vcxproj | 1 + rpcs3/rpcs3.vcxproj.filters | 3 + 8 files changed, 190 insertions(+), 141 deletions(-) create mode 100644 rpcs3/Emu/SysCalls/Modules/libsynth2.cpp create mode 100644 rpcs3/Emu/SysCalls/Modules/libsynth2.h diff --git a/rpcs3/Emu/Audio/cellAudio.h b/rpcs3/Emu/Audio/cellAudio.h index c0fe570980..2823dcab50 100644 --- a/rpcs3/Emu/Audio/cellAudio.h +++ b/rpcs3/Emu/Audio/cellAudio.h @@ -39,11 +39,6 @@ enum CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e, CELL_SND3_ERROR_REQUESTQUEFULL = 0x8031030f, CELL_SND3_ERROR_OUTPUTMODE = 0x80310310, - - //libsynt2 Error Codes - CELL_SOUND_SYNTH2_ERROR_FATAL = 0x80310201, - CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER = 0x80310202, - CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED = 0x80310203, }; // constants @@ -175,14 +170,3 @@ struct CellSnd3RequestQueueCtx void *rearQueue; be_t rearQueueSize; }; - -//libsynt2 datatypes -struct CellSoundSynth2EffectAttr -{ - be_t core; - be_t mode; - be_t depth_L; - be_t depth_R; - be_t delay; - be_t feedback; -}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index 25c9f7c41c..aa4a09cd86 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -7,8 +7,7 @@ #include "Emu/Audio/AudioDumper.h" void cellAudio_init(); -void cellAudio_unload(); -Module cellAudio(0x0011, cellAudio_init, nullptr, cellAudio_unload); +Module cellAudio(0x0011, cellAudio_init); static SMutexGeneral audioMutex; @@ -57,8 +56,8 @@ int cellAudioInit() uint oal_buffer_offset = 0; uint oal_buffer_size = sizeof(buffer) / sizeof(float); std::unique_ptr oal_buffer[32]; - SQueue queue; - for (u32 i = 0; i < queue.GetSize(); i++) + SQueue queue; + for (u32 i = 0; i < sizeof(oal_buffer) / sizeof(oal_buffer[0]); i++) { oal_buffer[i] = std::unique_ptr(new u16[oal_buffer_size]); memset(oal_buffer[i].get(), 0, oal_buffer_size * sizeof(u16)); @@ -118,7 +117,7 @@ int cellAudioInit() m_config.counter++; - const u32 oal_pos = m_config.counter % queue.GetSize(); + const u32 oal_pos = m_config.counter % (sizeof(oal_buffer) / sizeof(oal_buffer[0])); if (Emu.IsPaused()) { @@ -1039,110 +1038,6 @@ s32 cellSnd3SMFGetKeyOnID() //u32 smfID, u32 midiChannel, u32 *keyOnID return CELL_OK; } - //*libsynth2 Functions, NON active in this moment*// - -s32 cellSoundSynth2Config(s16 param, s32 value) -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -s32 cellSoundSynth2Init( s16 flag) -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -s32 cellSoundSynth2Exit() -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -void cellSoundSynth2SetParam(u16 register, u16 value) -{ - UNIMPLEMENTED_FUNC(cellAudio); - //TODO -} - -u16 cellSoundSynth2GetParam() //u16 register -{ - UNIMPLEMENTED_FUNC(cellAudio); - return CELL_OK; //it's NOT real value - //TODO -} - -void cellSoundSynth2SetSwitch(u16 register, u32 value) -{ - UNIMPLEMENTED_FUNC(cellAudio); - //TODO -} - -u32 cellSoundSynth2GetSwitch() //u16 register -{ - UNIMPLEMENTED_FUNC(cellAudio); - return CELL_OK; //it's NOT real value - //TODO -} - -u32 cellSoundSynth2SetAddr(u16 register, u32 value) -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -u32 cellSoundSynth2GetAddr() //u16 register -{ - UNIMPLEMENTED_FUNC(cellAudio); - return CELL_OK; //it's NOT real value - //TODO -} - -s32 cellSoundSynth2SetEffectAttr() //s16 bus, CellSoundSynth2EffectAttr *attr -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -s32 cellSoundSynth2SetEffectMode() //s16 bus, CellSoundSynth2EffectAttr *attr -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -void cellSoundSynth2SetCoreAttr(u16 entry, u16 value) -{ - UNIMPLEMENTED_FUNC(cellAudio); - //TODO -} - -s32 cellSoundSynth2Generate() //u16 samples, float *left_buffer, float *right_buffer, float *left_rear, float *right_rear -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -s32 cellSoundSynth2VoiceTrans() //s16 channel, u16 mode, u8 *m_addr, u32 s_addr, u32 size -{ - UNIMPLEMENTED_FUNC(cellAudio); - return 0; -} - -u16 cellSoundSynth2Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine -{ - UNIMPLEMENTED_FUNC(cellAudio); - return CELL_OK; //it's NOT real value - //TODO -} - -u16 cellSoundSynth2Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch -{ - UNIMPLEMENTED_FUNC(cellAudio); - return CELL_OK; //it's NOT real value - //TODO -} - - void cellAudio_init() { cellAudio.AddFunc(0x0b168f92, cellAudioInit); @@ -1161,11 +1056,4 @@ void cellAudio_init() cellAudio.AddFunc(0xdab029aa, cellAudioAddData); cellAudio.AddFunc(0xe4046afe, cellAudioGetPortBlockTag); cellAudio.AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue); - - //TODO: Find addresses for libmixer, libsnd3 and libsynth2 functions -} - -void cellAudio_unload() -{ - //StaticFinalize(); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index d57ce38a0f..f441922fa7 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -940,4 +940,8 @@ void libmixer_init() 0xffffffff78030020, 0xf000000048000000, // b ); + + REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB); + REG_SUB(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex); + REG_SUB(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp b/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp new file mode 100644 index 0000000000..7262ddc67b --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/libsynth2.cpp @@ -0,0 +1,159 @@ +#include "stdafx.h" +#include "Emu/SysCalls/SysCalls.h" +#include "Emu/SysCalls/SC_FUNC.h" + +void libsynth2_init(); +Module libsynth2("libsynth2", libsynth2_init); + +#include "libsynth2.h" + +int cellSoundSynth2Config(s16 param, int value) +{ + libsynth2.Error("cellSoundSynth2Config(param=%d, value=%d)", param, value); + return CELL_OK; +} + +int cellSoundSynth2Init(s16 flag) +{ + libsynth2.Error("cellSoundSynth2Init(flag=%d)", flag); + return CELL_OK; +} + +int cellSoundSynth2Exit() +{ + libsynth2.Error("cellSoundSynth2Exit()"); + return CELL_OK; +} + +void cellSoundSynth2SetParam(u16 reg, u16 value) +{ + libsynth2.Error("cellSoundSynth2SetParam(register=0x%x, value=0x%x)", reg, value); +} + +u16 cellSoundSynth2GetParam(u16 reg) +{ + libsynth2.Error("cellSoundSynth2GetParam(register=0x%x) -> 0", reg); + return 0; +} + +void cellSoundSynth2SetSwitch(u16 reg, u32 value) +{ + libsynth2.Error("cellSoundSynth2SetSwitch(register=0x%x, value=0x%x)", reg, value); +} + +u32 cellSoundSynth2GetSwitch(u16 reg) +{ + libsynth2.Error("cellSoundSynth2GetSwitch(register=0x%x) -> 0", reg); + return 0; +} + +int cellSoundSynth2SetAddr(u16 reg, u32 value) +{ + libsynth2.Error("cellSoundSynth2SetAddr(register=0x%x, value=0x%x)", reg, value); + return CELL_OK; +} + +u32 cellSoundSynth2GetAddr(u16 reg) +{ + libsynth2.Error("cellSoundSynth2GetAddr(register=0x%x) -> 0", reg); + return 0; +} + +int cellSoundSynth2SetEffectAttr(s16 bus, mem_ptr_t attr) +{ + libsynth2.Error("cellSoundSynth2SetEffectAttr(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr()); + return CELL_OK; +} + +int cellSoundSynth2SetEffectMode(s16 bus, mem_ptr_t attr) +{ + libsynth2.Error("cellSoundSynth2SetEffectMode(bus=%d, attr_addr=0x%x)", bus, attr.GetAddr()); + return CELL_OK; +} + +void cellSoundSynth2SetCoreAttr(u16 entry, u16 value) +{ + libsynth2.Error("cellSoundSynth2SetCoreAttr(entry=0x%x, value=0x%x)", entry, value); +} + +int cellSoundSynth2Generate(u16 samples, u32 L_addr, u32 R_addr, u32 Lr_addr, u32 Rr_addr) +{ + libsynth2.Error("cellSoundSynth2Generate(samples=0x%x, left=0x%x, right=0x%x, left_rear=0x%x, right_rear=0x%x)", + samples, L_addr, R_addr, Lr_addr, Rr_addr); + return CELL_OK; +} + +int cellSoundSynth2VoiceTrans(s16 channel, u16 mode, u32 mem_side_addr, u32 lib_side_addr, u32 size) +{ + libsynth2.Error("cellSoundSynth2VoiceTrans(channel=%d, mode=0x%x, m_addr=0x%x, s_addr=0x%x, size=0x%x)", + channel, mode, mem_side_addr, lib_side_addr, size); + return CELL_OK; +} + +int cellSoundSynth2VoiceTransStatus(s16 channel, s16 flag) +{ + libsynth2.Error("cellSoundSynth2VoiceTransStatus(channel=%d, flag=%d)", channel, flag); + return CELL_OK; +} + +u16 cellSoundSynth2Note2Pitch(u16 center_note, u16 center_fine, u16 note, s16 fine) +{ + libsynth2.Error("cellSoundSynth2Note2Pitch(center_note=0x%x, center_fine=0x%x, note=0x%x, fine=%d) -> 0", + center_note, center_fine, note, fine); + return 0; +} + +u16 cellSoundSynth2Pitch2Note(u16 center_note, u16 center_fine, u16 pitch) +{ + libsynth2.Error("cellSoundSynth2Pitch2Note(center_note=0x%x, center_fine=0x%x, pitch=0x%x) -> 0", + center_note, center_fine, pitch); + return 0; +} + +void libsynth2_init() +{ + REG_SUB(libsynth2, "synth2", cellSoundSynth2Init, + /* + 0xffffffff7d800026, + 0xfffffffff821ff41, + 0xfffffffffb610098, + 0xff0000008362001c, // lwz + 0xfffffffffb8100a0, + 0xffffffff3f9b0008, + 0xfffffffffba100a8, + 0xffffffff3fa08031, + 0xfffffffffbe100b8, + 0xfffffffffb010080, + 0xfffffffffb210088, + 0xfffffffffb410090, + 0xfffffffffbc100b0, + 0xffffffff7c7f1b78, + 0xffffffff63bd0203, + 0xffffffff918100c8, + 0xffffffff7c0802a6, + 0xfffffffff80100d0, + 0xffffffff897c7688, + 0xffffffff2f8b0000, + 0xffffff00409e01fc, // bne + 0xffffffff38000002, + 0xffffffff39200020, + 0xffffffff3ba00000, + */ + ); + REG_SUB(libsynth2, "synth2", cellSoundSynth2Exit); + REG_SUB(libsynth2, "synth2", cellSoundSynth2Config); + REG_SUB(libsynth2, "synth2", cellSoundSynth2GetAddr); + REG_SUB(libsynth2, "synth2", cellSoundSynth2GetParam); + REG_SUB(libsynth2, "synth2", cellSoundSynth2GetSwitch); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetAddr); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetParam); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetSwitch); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetEffectMode); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetEffectAttr); + REG_SUB(libsynth2, "synth2", cellSoundSynth2Note2Pitch); + REG_SUB(libsynth2, "synth2", cellSoundSynth2Pitch2Note); + REG_SUB(libsynth2, "synth2", cellSoundSynth2VoiceTrans); + REG_SUB(libsynth2, "synth2", cellSoundSynth2VoiceTransStatus); + REG_SUB(libsynth2, "synth2", cellSoundSynth2SetCoreAttr); + REG_SUB(libsynth2, "synth2", cellSoundSynth2Generate); +} \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/libsynth2.h b/rpcs3/Emu/SysCalls/Modules/libsynth2.h new file mode 100644 index 0000000000..8b1c428855 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/libsynth2.h @@ -0,0 +1,19 @@ +#pragma once + +enum +{ + //libsynt2 Error Codes + CELL_SOUND_SYNTH2_ERROR_FATAL = 0x80310201, + CELL_SOUND_SYNTH2_ERROR_INVALID_PARAMETER = 0x80310202, + CELL_SOUND_SYNTH2_ERROR_ALREADY_INITIALIZED = 0x80310203, +}; + +struct CellSoundSynth2EffectAttr +{ + be_t core; + be_t mode; + be_t depth_L; + be_t depth_R; + be_t delay; + be_t feedback; +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 5cfd8acccb..107cf36520 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -153,15 +153,6 @@ void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_tGetPath(); - std::string::size_type first_slash = path.find('/'); - if (first_slash == std::string::npos) - { - path = ""; - } - else - { - path = path.substr(first_slash+1,std::string::npos); - } u64 nbytes = aio->size; u32 buf_addr = aio->buf_addr; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 5aa56519bc..db1fa9e1d4 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -314,6 +314,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 1c1ed0a365..d3e2c7f3d1 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -487,6 +487,9 @@ Utilities + + Emu\SysCalls\Modules +