mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +00:00
cellSync: global mutex avoided
cellAudio: level bug fixed
This commit is contained in:
parent
b6d8f1e028
commit
1e02598903
@ -21,24 +21,6 @@ enum
|
||||
CELL_AUDIO_ERROR_EVENT_QUEUE = 0x8031070d,
|
||||
CELL_AUDIO_ERROR_AUDIOSYSTEM_NOT_FOUND = 0x8031070e,
|
||||
CELL_AUDIO_ERROR_TAG_NOT_FOUND = 0x8031070f,
|
||||
|
||||
//libsnd3 Error Codes
|
||||
CELL_SND3_ERROR_PARAM = 0x80310301,
|
||||
CELL_SND3_ERROR_CREATE_MUTEX = 0x80310302,
|
||||
CELL_SND3_ERROR_SYNTH = 0x80310303,
|
||||
CELL_SND3_ERROR_ALREADY = 0x80310304,
|
||||
CELL_SND3_ERROR_NOTINIT = 0x80310305,
|
||||
CELL_SND3_ERROR_SMFFULL = 0x80310306,
|
||||
CELL_SND3_ERROR_HD3ID = 0x80310307,
|
||||
CELL_SND3_ERROR_SMF = 0x80310308,
|
||||
CELL_SND3_ERROR_SMFCTX = 0x80310309,
|
||||
CELL_SND3_ERROR_FORMAT = 0x8031030a,
|
||||
CELL_SND3_ERROR_SMFID = 0x8031030b,
|
||||
CELL_SND3_ERROR_SOUNDDATAFULL = 0x8031030c,
|
||||
CELL_SND3_ERROR_VOICENUM = 0x8031030d,
|
||||
CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e,
|
||||
CELL_SND3_ERROR_REQUESTQUEFULL = 0x8031030f,
|
||||
CELL_SND3_ERROR_OUTPUTMODE = 0x80310310,
|
||||
};
|
||||
|
||||
// constants
|
||||
@ -137,36 +119,4 @@ struct AudioConfig //custom structure
|
||||
}
|
||||
};
|
||||
|
||||
extern AudioConfig m_config;
|
||||
|
||||
//libsnd3 datatypes
|
||||
struct CellSnd3DataCtx
|
||||
{
|
||||
s8 system; //[CELL_SND3_DATA_CTX_SIZE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3SmfCtx
|
||||
{
|
||||
s8 system; //[CELL_SND3_SMF_CTX_SIZE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3KeyOnParam
|
||||
{
|
||||
u8 vel;
|
||||
u8 pan;
|
||||
u8 panEx;
|
||||
be_t<s32> addPitch;
|
||||
};
|
||||
|
||||
struct CellSnd3VoiceBitCtx
|
||||
{
|
||||
be_t<u32> core; //[CELL_SND3_MAX_CORE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3RequestQueueCtx
|
||||
{
|
||||
void *frontQueue;
|
||||
be_t<u32> frontQueueSize;
|
||||
void *rearQueue;
|
||||
be_t<u32> rearQueueSize;
|
||||
};
|
||||
extern AudioConfig m_config;
|
@ -140,7 +140,7 @@ int cellAudioInit()
|
||||
auto buf = (be_t<float>*)&Memory[buf_addr];
|
||||
|
||||
static const float k = 1.0f;
|
||||
const float m = (port.level == 0.0f) ? 1.0f : port.level;
|
||||
const float m = port.level;
|
||||
|
||||
if (port.channel == 2)
|
||||
{
|
||||
@ -209,12 +209,24 @@ int cellAudioInit()
|
||||
memset(buf, 0, block_size * sizeof(float));
|
||||
}
|
||||
|
||||
// convert the data from float to u16 and clip:
|
||||
// convert the data from float to u16 with clipping:
|
||||
if (!first_mix)
|
||||
{
|
||||
for (u32 i = 0; i < (sizeof(buffer) / sizeof(float)); i++)
|
||||
/*for (u32 i = 0; i < (sizeof(buffer) / sizeof(float)); i++)
|
||||
{
|
||||
oal_buffer[oal_pos][oal_buffer_offset + i] = (s16)(min<float>(max<float>(buffer[i] * 0x8000, -0x8000), 0x7fff));
|
||||
}*/
|
||||
// 2x MULPS
|
||||
// 2x MAXPS (optional)
|
||||
// 2x MINPS (optional)
|
||||
// 2x CVTPS2DQ (converts float to s32)
|
||||
// PACKSSDW (converts s32 to s16 with clipping)
|
||||
for (u32 i = 0; i < (sizeof(buffer) / sizeof(float)); i += 8)
|
||||
{
|
||||
static const __m128 float2u16 = { 0x8000, 0x8000, 0x8000, 0x8000 };
|
||||
(__m128i&)(oal_buffer[oal_pos][oal_buffer_offset + i]) = _mm_packs_epi32(
|
||||
_mm_cvtps_epi32(_mm_mul_ps((__m128&)(buffer[i]), float2u16)),
|
||||
_mm_cvtps_epi32(_mm_mul_ps((__m128&)(buffer[i + 4]), float2u16)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,10 +286,8 @@ int cellAudioInit()
|
||||
}
|
||||
}
|
||||
|
||||
const u64 stamp4 = get_system_time();
|
||||
|
||||
//ConLog.Write("Audio perf: start=%d (access=%d, AddData=%d, events=%d, dump=%d)",
|
||||
//stamp0 - m_config.start_time, stamp1-stamp0, stamp2-stamp1, stamp3-stamp2, stamp4-stamp3);
|
||||
//stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
|
||||
}
|
||||
ConLog.Write("Audio finished");
|
||||
abort:
|
||||
@ -374,7 +384,14 @@ int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
|
||||
port.channel = audioParam->nChannel;
|
||||
port.block = audioParam->nBlock;
|
||||
port.attr = audioParam->attr;
|
||||
port.level = audioParam->level;
|
||||
if (port.attr & CELL_AUDIO_PORTATTR_INITLEVEL)
|
||||
{
|
||||
port.level = audioParam->level;
|
||||
}
|
||||
else
|
||||
{
|
||||
port.level = 1.0f;
|
||||
}
|
||||
|
||||
portNum = i;
|
||||
cellAudio.Warning("*** audio port opened(nChannel=%d, nBlock=%d, attr=0x%llx, level=%f): port = %d",
|
||||
@ -723,321 +740,6 @@ int cellAudioUnsetPersonalDevice(int iPersonalStream)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
//*libsnd3 Functions, NOT active in this moment
|
||||
s32 cellSnd3Init() //u32 maxVoice, u32 samples, CellSnd3RequestQueueCtx *queue
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3Exit()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetOutputMode() //u32 mode
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3Synthesis() //float *pOutL, float *pOutR
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SynthesisEx() //float *pOutL, float *pOutR, float *pOutRL, float *pOutRR
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetReserveMode() //u32 voiceNum, u32 reserveMode
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3BindSoundData() //CellSnd3DataCtx *snd3Ctx, void *hd3, u32 synthMemOffset
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3UnbindSoundData(u32 hd3ID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOnByTone() //u32 hd3ID, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3KeyOnByTone() //u32 hd3ID, u32 toneIndex, u32 pitch,u32 keyOnID,CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceNoteOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceKeyOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 pitch, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetSustainHold(u32 voiceNum, u32 sustainHold)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceKeyOff(u32 voiceNum)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPitch(u32 voiceNum, s32 addPitch)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetVelocity(u32 voiceNum, u32 velocity)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPanpot(u32 voiceNum, u32 panpot)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPanpotEx(u32 voiceNum, u32 panpotEx)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPitchBend(u32 voiceNum, u32 bendValue)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceAllKeyOff()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceGetEnvelope(u32 voiceNum)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceGetStatus() //u32 voiceNum
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
u32 cellSnd3KeyOffByID(u32 keyOnID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3GetVoice() //u32 midiChannel, u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3GetVoiceByID() //u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOn() //u32 hd3ID, u32 midiChannel, u32 midiProgram, u32 midiNote, u32 sustain,CellSnd3KeyOnParam *keyOnParam, u32 keyOnID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOff(u32 midiChannel, u32 midiNote, u32 keyOnID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetSustainHold(u32 midiChannel, u32 sustainHold, u32 ID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetEffectType(u16 effectType, s16 returnVol, u16 delay, u16 feedback)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
u16 cellSnd3Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
u16 cellSnd3Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFBind() //CellSnd3SmfCtx *smfCtx, void *smf, u32 hd3ID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFUnbind() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPlay(u32 smfID, u32 playVelocity, u32 playPan, u32 playCount)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPlayEx(u32 smfID, u32 playVelocity, u32 playPan, u32 playPanEx, u32 playCount)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPause(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFResume(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFStop(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFAddTempo(u32 smfID, s32 addTempo)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetTempo() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayVelocity(u32 smfID, u32 playVelocity)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayVelocity() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayPanpot(u32 smfID, u32 playPanpot)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayPanpotEx(u32 smfID, u32 playPanpotEx)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayPanpot() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayPanpotEx() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayStatus() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayChannel(u32 smfID, u32 playChannelBit)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayChannel() //u32 smfID, u32 *playChannelBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetKeyOnID() //u32 smfID, u32 midiChannel, u32 *keyOnID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellAudio);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void cellAudio_init()
|
||||
{
|
||||
cellAudio.AddFunc(0x0b168f92, cellAudioInit);
|
||||
|
@ -25,11 +25,13 @@ enum
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct CellSyncMutex {
|
||||
be_t<u16> m_freed;
|
||||
be_t<u16> m_order;
|
||||
volatile u32& m_data(){
|
||||
return *reinterpret_cast<u32*>(this);
|
||||
};
|
||||
be_t<u16> m_freed;
|
||||
be_t<u16> m_order;
|
||||
|
||||
volatile u32& m_data()
|
||||
{
|
||||
return *reinterpret_cast<u32*>(this);
|
||||
};
|
||||
/*
|
||||
(???) Initialize: set zeros
|
||||
(???) Lock: increase m_order and wait until m_freed == old m_order
|
||||
@ -52,16 +54,8 @@ int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
if ((reservation.addr + reservation.size > mutex.GetAddr() && reservation.addr <= mutex.GetAddr() + 4) ||
|
||||
(mutex.GetAddr() + 4 > reservation.addr && mutex.GetAddr() <= reservation.addr + reservation.size))
|
||||
{
|
||||
reservation.clear();
|
||||
}
|
||||
mutex->m_data() = 0;
|
||||
return CELL_OK;
|
||||
}
|
||||
mutex->m_data() = 0;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
|
||||
@ -78,22 +72,18 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
|
||||
}
|
||||
|
||||
be_t<u16> old_order;
|
||||
while (true)
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
if ((reservation.addr + reservation.size > mutex.GetAddr() && reservation.addr <= mutex.GetAddr() + 4) ||
|
||||
(mutex.GetAddr() + 4 > reservation.addr && mutex.GetAddr() <= reservation.addr + reservation.size))
|
||||
{
|
||||
reservation.clear();
|
||||
}
|
||||
old_order = mutex->m_order;
|
||||
mutex->m_order = mutex->m_order + 1;
|
||||
if (old_order == mutex->m_freed)
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
const u32 old_data = mutex->m_data();
|
||||
CellSyncMutex new_mutex;
|
||||
new_mutex.m_data() = old_data;
|
||||
|
||||
old_order = new_mutex.m_order;
|
||||
new_mutex.m_order++;
|
||||
if (InterlockedCompareExchange(&mutex->m_data(), new_mutex.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
while (old_order != Memory.Read16(mutex.GetAddr()))
|
||||
while (old_order != mutex->m_freed)
|
||||
{
|
||||
Sleep(1);
|
||||
if (Emu.IsStopped())
|
||||
@ -118,20 +108,28 @@ int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
|
||||
{
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
int res;
|
||||
|
||||
while (true)
|
||||
{
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
if ((reservation.addr + reservation.size > mutex.GetAddr() && reservation.addr <= mutex.GetAddr() + 4) ||
|
||||
(mutex.GetAddr() + 4 > reservation.addr && mutex.GetAddr() <= reservation.addr + reservation.size))
|
||||
const u32 old_data = mutex->m_data();
|
||||
CellSyncMutex new_mutex;
|
||||
new_mutex.m_data() = old_data;
|
||||
|
||||
if (new_mutex.m_order != new_mutex.m_freed)
|
||||
{
|
||||
reservation.clear();
|
||||
res = CELL_SYNC_ERROR_BUSY;
|
||||
}
|
||||
if (mutex->m_order != mutex->m_freed)
|
||||
else
|
||||
{
|
||||
return CELL_SYNC_ERROR_BUSY;
|
||||
new_mutex.m_order++;
|
||||
res = CELL_OK;
|
||||
}
|
||||
mutex->m_order = mutex->m_order + 1;
|
||||
return CELL_OK;
|
||||
if (InterlockedCompareExchange(&mutex->m_data(), new_mutex.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
|
||||
@ -147,16 +145,17 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
|
||||
return CELL_SYNC_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
{ /* global mutex */
|
||||
SMutexLocker lock(reservation.mutex);
|
||||
if ((reservation.addr + reservation.size > mutex.GetAddr() && reservation.addr <= mutex.GetAddr() + 4) ||
|
||||
(mutex.GetAddr() + 4 > reservation.addr && mutex.GetAddr() <= reservation.addr + reservation.size))
|
||||
{
|
||||
reservation.clear();
|
||||
}
|
||||
mutex->m_freed = mutex->m_freed + 1;
|
||||
return CELL_OK;
|
||||
while (true)
|
||||
{
|
||||
const u32 old_data = mutex->m_data();
|
||||
CellSyncMutex new_mutex;
|
||||
new_mutex.m_data() = old_data;
|
||||
|
||||
new_mutex.m_freed++;
|
||||
if (InterlockedCompareExchange(&mutex->m_data(), new_mutex.m_data(), old_data) == old_data) break;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void cellSync_init()
|
||||
|
327
rpcs3/Emu/SysCalls/Modules/libsnd3.cpp
Normal file
327
rpcs3/Emu/SysCalls/Modules/libsnd3.cpp
Normal file
@ -0,0 +1,327 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
void libsnd3_init();
|
||||
Module libsnd3("libsnd3", libsnd3_init);
|
||||
|
||||
#include "libsnd3.h"
|
||||
|
||||
s32 cellSnd3Init() //u32 maxVoice, u32 samples, CellSnd3RequestQueueCtx *queue
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3Exit()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetOutputMode() //u32 mode
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3Synthesis() //float *pOutL, float *pOutR
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SynthesisEx() //float *pOutL, float *pOutR, float *pOutRL, float *pOutRR
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetReserveMode() //u32 voiceNum, u32 reserveMode
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3BindSoundData() //CellSnd3DataCtx *snd3Ctx, void *hd3, u32 synthMemOffset
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3UnbindSoundData(u32 hd3ID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOnByTone() //u32 hd3ID, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3KeyOnByTone() //u32 hd3ID, u32 toneIndex, u32 pitch,u32 keyOnID,CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceNoteOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 note, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceKeyOnByTone() //u32 hd3ID, u32 voiceNum, u32 toneIndex, u32 pitch, u32 keyOnID, CellSnd3KeyOnParam *keyOnParam
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetSustainHold(u32 voiceNum, u32 sustainHold)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceKeyOff(u32 voiceNum)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPitch(u32 voiceNum, s32 addPitch)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetVelocity(u32 voiceNum, u32 velocity)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPanpot(u32 voiceNum, u32 panpot)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPanpotEx(u32 voiceNum, u32 panpotEx)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceSetPitchBend(u32 voiceNum, u32 bendValue)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceAllKeyOff()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceGetEnvelope(u32 voiceNum)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3VoiceGetStatus() //u32 voiceNum
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
u32 cellSnd3KeyOffByID(u32 keyOnID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3GetVoice() //u32 midiChannel, u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3GetVoiceByID() //u32 keyOnID, CellSnd3VoiceBitCtx *voiceBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOn() //u32 hd3ID, u32 midiChannel, u32 midiProgram, u32 midiNote, u32 sustain,CellSnd3KeyOnParam *keyOnParam, u32 keyOnID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3NoteOff(u32 midiChannel, u32 midiNote, u32 keyOnID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetSustainHold(u32 midiChannel, u32 sustainHold, u32 ID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SetEffectType(u16 effectType, s16 returnVol, u16 delay, u16 feedback)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
u16 cellSnd3Note2Pitch() //u16 center_note, u16 center_fine, u16 note, s16 fine
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
u16 cellSnd3Pitch2Note() //u16 center_note, u16 center_fine, u16 pitch
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFBind() //CellSnd3SmfCtx *smfCtx, void *smf, u32 hd3ID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFUnbind() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPlay(u32 smfID, u32 playVelocity, u32 playPan, u32 playCount)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPlayEx(u32 smfID, u32 playVelocity, u32 playPan, u32 playPanEx, u32 playCount)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFPause(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFResume(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFStop(u32 smfID)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFAddTempo(u32 smfID, s32 addTempo)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetTempo() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayVelocity(u32 smfID, u32 playVelocity)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayVelocity() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayPanpot(u32 smfID, u32 playPanpot)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayPanpotEx(u32 smfID, u32 playPanpotEx)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayPanpot() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayPanpotEx() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayStatus() //u32 smfID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK; //it's NOT real value
|
||||
//TODO
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFSetPlayChannel(u32 smfID, u32 playChannelBit)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetPlayChannel() //u32 smfID, u32 *playChannelBit
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 cellSnd3SMFGetKeyOnID() //u32 smfID, u32 midiChannel, u32 *keyOnID
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(libsnd3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void libsnd3_init()
|
||||
{
|
||||
|
||||
}
|
54
rpcs3/Emu/SysCalls/Modules/libsnd3.h
Normal file
54
rpcs3/Emu/SysCalls/Modules/libsnd3.h
Normal file
@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
//libsnd3 Error Codes
|
||||
enum
|
||||
{
|
||||
CELL_SND3_ERROR_PARAM = 0x80310301,
|
||||
CELL_SND3_ERROR_CREATE_MUTEX = 0x80310302,
|
||||
CELL_SND3_ERROR_SYNTH = 0x80310303,
|
||||
CELL_SND3_ERROR_ALREADY = 0x80310304,
|
||||
CELL_SND3_ERROR_NOTINIT = 0x80310305,
|
||||
CELL_SND3_ERROR_SMFFULL = 0x80310306,
|
||||
CELL_SND3_ERROR_HD3ID = 0x80310307,
|
||||
CELL_SND3_ERROR_SMF = 0x80310308,
|
||||
CELL_SND3_ERROR_SMFCTX = 0x80310309,
|
||||
CELL_SND3_ERROR_FORMAT = 0x8031030a,
|
||||
CELL_SND3_ERROR_SMFID = 0x8031030b,
|
||||
CELL_SND3_ERROR_SOUNDDATAFULL = 0x8031030c,
|
||||
CELL_SND3_ERROR_VOICENUM = 0x8031030d,
|
||||
CELL_SND3_ERROR_RESERVEDVOICE = 0x8031030e,
|
||||
CELL_SND3_ERROR_REQUESTQUEFULL = 0x8031030f,
|
||||
CELL_SND3_ERROR_OUTPUTMODE = 0x80310310,
|
||||
};
|
||||
|
||||
//libsnd3 datatypes
|
||||
struct CellSnd3DataCtx
|
||||
{
|
||||
s8 system; //[CELL_SND3_DATA_CTX_SIZE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3SmfCtx
|
||||
{
|
||||
s8 system; //[CELL_SND3_SMF_CTX_SIZE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3KeyOnParam
|
||||
{
|
||||
u8 vel;
|
||||
u8 pan;
|
||||
u8 panEx;
|
||||
be_t<s32> addPitch;
|
||||
};
|
||||
|
||||
struct CellSnd3VoiceBitCtx
|
||||
{
|
||||
be_t<u32> core; //[CELL_SND3_MAX_CORE], unknown identifier
|
||||
};
|
||||
|
||||
struct CellSnd3RequestQueueCtx
|
||||
{
|
||||
void *frontQueue;
|
||||
be_t<u32> frontQueueSize;
|
||||
void *rearQueue;
|
||||
be_t<u32> rearQueueSize;
|
||||
};
|
@ -314,7 +314,6 @@
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVdec.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellVpost.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\libmixer.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\libsynth2.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
||||
|
@ -487,9 +487,6 @@
|
||||
<ClCompile Include="..\Utilities\StrFmt.cpp">
|
||||
<Filter>Utilities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\Modules\libsynth2.cpp">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="rpcs3.rc" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user