Conflicts fixed

This commit is contained in:
Nekotekina 2014-04-04 18:43:43 +04:00
commit c6c6dbe546
102 changed files with 3039 additions and 3008 deletions

View file

@ -1,11 +1,8 @@
#pragma once #pragma once
extern u64 get_system_time();
// Error codes // Error codes
enum enum
{ {
//libaudio Error Codes
CELL_AUDIO_ERROR_ALREADY_INIT = 0x80310701, CELL_AUDIO_ERROR_ALREADY_INIT = 0x80310701,
CELL_AUDIO_ERROR_AUDIOSYSTEM = 0x80310702, CELL_AUDIO_ERROR_AUDIOSYSTEM = 0x80310702,
CELL_AUDIO_ERROR_NOT_INIT = 0x80310703, CELL_AUDIO_ERROR_NOT_INIT = 0x80310703,

View file

@ -257,3 +257,23 @@ struct CellAudioInDeviceConfiguration
u8 reserved[31]; u8 reserved[31];
}; };
enum CellBgmPlaybackStatusState
{
CELL_BGMPLAYBACK_STATUS_PLAY = 0,
CELL_BGMPLAYBACK_STATUS_STOP = 1
};
enum CellBgmPlaybackStatusEnabled
{
CELL_BGMPLAYBACK_STATUS_ENABLE = 0,
CELL_BGMPLAYBACK_STATUS_DISABLE = 1
};
struct CellBgmPlaybackStatus
{
u8 playbackState;
u8 enabled;
char contentId[16];
u8 fadeRatio;
char reserved[13];
};

View file

@ -79,10 +79,8 @@ enum
CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED = 0x80612438, CELL_ADEC_ERROR_M4AAC_INVERSE_QUANTIZATION_FAILED = 0x80612438,
CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED = 0x80612439, CELL_ADEC_ERROR_M4AAC_GET_CB_MAP_FAILED = 0x80612439,
CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED = 0x8061243a, CELL_ADEC_ERROR_M4AAC_GET_PULSE_FAILED = 0x8061243a,
CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED CELL_ADEC_ERROR_M4AAC_MONO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED = 0x8061243b,
= 0x8061243b, CELL_ADEC_ERROR_M4AAC_STEREO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED = 0x8061243c,
CELL_ADEC_ERROR_M4AAC_STEREO_MIXDOWN_ELEMENT_IS_NOT_SUPPORTED
= 0x8061243c,
CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW = 0x80612480, CELL_ADEC_ERROR_M4AAC_SBR_CH_OVERFLOW = 0x80612480,
CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH = 0x80612481, CELL_ADEC_ERROR_M4AAC_SBR_NOSYNCH = 0x80612481,

View file

@ -319,8 +319,10 @@ int cellAudioInit()
const u64 stamp1 = get_system_time(); const u64 stamp1 = get_system_time();
if (!first_mix) if (first_mix)
{ {
memset(&oal_buffer[oal_pos][0], 0, oal_buffer_size * sizeof(u16));
}
oal_buffer_offset += sizeof(buf2ch) / sizeof(float); oal_buffer_offset += sizeof(buf2ch) / sizeof(float);
if(oal_buffer_offset >= oal_buffer_size) if(oal_buffer_offset >= oal_buffer_size)
@ -332,7 +334,6 @@ int cellAudioInit()
oal_buffer_offset = 0; oal_buffer_offset = 0;
} }
}
const u64 stamp2 = get_system_time(); const u64 stamp2 = get_system_time();

View file

@ -257,6 +257,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPn
current_outParam.outputWidth = current_info.imageWidth; current_outParam.outputWidth = current_info.imageWidth;
current_outParam.outputHeight = current_info.imageHeight; current_outParam.outputHeight = current_info.imageHeight;
current_outParam.outputColorSpace = inParam->outputColorSpace; current_outParam.outputColorSpace = inParam->outputColorSpace;
switch (current_outParam.outputColorSpace) switch (current_outParam.outputColorSpace)
{ {
case CELL_PNGDEC_PALETTE: case CELL_PNGDEC_PALETTE:

View file

@ -1,7 +1,6 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include <mutex>
void cellSync_init(); void cellSync_init();
Module cellSync("cellSync", cellSync_init); Module cellSync("cellSync", cellSync_init);
@ -23,8 +22,8 @@ enum
CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410114, CELL_SYNC_ERROR_NO_SPU_CONTEXT_STORAGE = 0x80410114,
}; };
#pragma pack(push, 1) struct CellSyncMutex
struct CellSyncMutex { {
be_t<u16> m_freed; be_t<u16> m_freed;
be_t<u16> m_order; be_t<u16> m_order;
@ -39,7 +38,8 @@ struct CellSyncMutex {
(???) TryLock: ????? (???) TryLock: ?????
*/ */
}; };
#pragma pack(pop)
static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong sizeof");
int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex) int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
{ {

View file

@ -911,6 +911,19 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_
return CELL_OK; return CELL_OK;
} }
int cellSysutilGetBgmPlaybackStatus(mem_ptr_t<CellBgmPlaybackStatus> status)
{
cellSysutil.Warning("cellSysutilGetBgmPlaybackStatus(status=0x%x)", status.GetAddr());
// non-essential, so always assume background music is stopped/disabled
status->playbackState = CELL_BGMPLAYBACK_STATUS_STOP;
status->enabled = CELL_BGMPLAYBACK_STATUS_DISABLE;
status->fadeRatio = 0; // volume ratio
memset(status->contentId, 0, sizeof(status->contentId));
return CELL_OK;
}
void cellSysutil_init() void cellSysutil_init()
{ {
cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt);
@ -940,6 +953,8 @@ void cellSysutil_init()
cellSysutil.AddFunc(0xed5d96af, cellAudioOutGetConfiguration); cellSysutil.AddFunc(0xed5d96af, cellAudioOutGetConfiguration);
cellSysutil.AddFunc(0xc96e89e9, cellAudioOutSetCopyControl); cellSysutil.AddFunc(0xc96e89e9, cellAudioOutSetCopyControl);
cellSysutil.AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus);
cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount); cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount);
cellSysutil.AddFunc(0x744c1544, cellSysCacheClear); cellSysutil.AddFunc(0x744c1544, cellSysCacheClear);

View file

@ -155,6 +155,8 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
picInfo->reserved1 = 0; picInfo->reserved1 = 0;
picInfo->reserved2 = 0; picInfo->reserved2 = 0;
u64 stamp0 = get_system_time();
u8* pY = (u8*)malloc(w*h); // color planes u8* pY = (u8*)malloc(w*h); // color planes
u8* pU = (u8*)malloc(w*h/4); u8* pU = (u8*)malloc(w*h/4);
u8* pV = (u8*)malloc(w*h/4); u8* pV = (u8*)malloc(w*h/4);
@ -182,8 +184,12 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
memset(pA, alpha, w*h); memset(pA, alpha, w*h);
u64 stamp1 = get_system_time();
SwsContext* sws = sws_getContext(w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL); SwsContext* sws = sws_getContext(w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
u64 stamp2 = get_system_time();
u8* in_data[4] = { pY, pU, pV, pA }; u8* in_data[4] = { pY, pU, pV, pA };
int in_line[4] = { w, w/2, w/2, w }; int in_line[4] = { w, w/2, w/2, w };
u8* out_data[4] = { (u8*)res, NULL, NULL, NULL }; u8* out_data[4] = { (u8*)res, NULL, NULL, NULL };
@ -193,24 +199,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
sws_freeContext(sws); sws_freeContext(sws);
/* u64 stamp3 = get_system_time();
for (u32 i = 0; i < h; i++) for (u32 j = 0; j < w; j++)
{
float Cr = pV[(i/2)*(w/2)+j/2] - 128;
float Cb = pU[(i/2)*(w/2)+j/2] - 128;
float Y = pY[i*w+j];
int R = Y + 1.5701f * Cr;
if (R < 0) R = 0;
if (R > 255) R = 255;
int G = Y - 0.1870f * Cb - 0.4664f * Cr;
if (G < 0) G = 0;
if (G > 255) G = 255;
int B = Y - 1.8556f * Cb;
if (B < 0) B = 0;
if (B > 255) B = 255;
res[i*w+j] = ((u32)alpha << 24) | (B << 16) | (G << 8) | (R);
}*/
if (!Memory.CopyFromReal(outPicBuff_addr, res, ow*oh*4)) if (!Memory.CopyFromReal(outPicBuff_addr, res, ow*oh*4))
{ {
@ -223,6 +212,9 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
free(pV); free(pV);
free(pA); free(pA);
free(res); free(res);
//ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)",
//stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
return CELL_OK; return CELL_OK;
} }

View file

@ -1,8 +1,7 @@
#pragma once #pragma once
enum enum //libmixer Error Codes
{ {
//libmixer Error Codes
CELL_LIBMIXER_ERROR_NOT_INITIALIZED = 0x80310002, CELL_LIBMIXER_ERROR_NOT_INITIALIZED = 0x80310002,
CELL_LIBMIXER_ERROR_INVALID_PARAMATER = 0x80310003, CELL_LIBMIXER_ERROR_INVALID_PARAMATER = 0x80310003,
CELL_LIBMIXER_ERROR_NO_MEMORY = 0x80310005, CELL_LIBMIXER_ERROR_NO_MEMORY = 0x80310005,

View file

@ -471,3 +471,5 @@ void StaticFinalize();
#define REG_SUB(module, group, name,...) \ #define REG_SUB(module, group, name,...) \
static const u64 name ## _table[] = {__VA_ARGS__ ## 0}; \ static const u64 name ## _table[] = {__VA_ARGS__ ## 0}; \
module.AddFuncSub(group, name ## _table, #name, name) module.AddFuncSub(group, name ## _table, #name, name)
extern u64 get_system_time();

View file

@ -74,6 +74,7 @@ int sys_cond_signal(u32 cond_id)
if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop())) if (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
{ {
cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
if (Emu.IsStopped()) if (Emu.IsStopped())
@ -99,6 +100,7 @@ int sys_cond_signal_all(u32 cond_id)
while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop())) while (u32 target = (mutex->protocol == SYS_SYNC_PRIORITY ? cond->m_queue.pop_prio() : cond->m_queue.pop()))
{ {
cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
if (Emu.IsStopped()) if (Emu.IsStopped())
@ -134,6 +136,7 @@ int sys_cond_signal_to(u32 cond_id, u32 thread_id)
u32 target = thread_id; u32 target = thread_id;
{ {
cond->signal_stamp = get_system_time();
cond->signal.lock(target); cond->signal.lock(target);
} }
@ -199,7 +202,9 @@ int sys_cond_wait(u32 cond_id, u64 timeout)
} }
} }
mutex->recursive = 1; mutex->recursive = 1;
const volatile u64 stamp = cond->signal_stamp;
cond->signal.unlock(tid); cond->signal.unlock(tid);
//ConLog.Write("sys_cond_wait(): signal latency %d", get_system_time() - stamp);
return CELL_OK; return CELL_OK;
} }

View file

@ -18,6 +18,7 @@ struct Cond
Mutex* mutex; // associated with mutex Mutex* mutex; // associated with mutex
SMutex signal; SMutex signal;
SleepQueue m_queue; SleepQueue m_queue;
u64 signal_stamp;
Cond(Mutex* mutex, u64 name) Cond(Mutex* mutex, u64 name)
: mutex(mutex) : mutex(mutex)