mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
c++11 fixups. Initialise to zero where possible. note: cellAudio looks quite messed up.
This commit is contained in:
parent
582825934c
commit
6bd044f9be
@ -643,9 +643,8 @@ void GLVertexProgram::Compile()
|
|||||||
|
|
||||||
if(r)
|
if(r)
|
||||||
{
|
{
|
||||||
char* buf = new char[r+1];
|
char* buf = new char[r+1]();
|
||||||
GLsizei len;
|
GLsizei len;
|
||||||
memset(buf, 0, r+1);
|
|
||||||
glGetShaderInfoLog(id, r, &len, buf);
|
glGetShaderInfoLog(id, r, &len, buf);
|
||||||
LOG_ERROR(RSX, "Failed to compile vertex shader: %s", buf);
|
LOG_ERROR(RSX, "Failed to compile vertex shader: %s", buf);
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
|
@ -110,8 +110,7 @@ int cellPadGetData(u32 port_no, u32 data_addr)
|
|||||||
if(port_no >= rinfo.now_connect) return CELL_PAD_ERROR_NO_DEVICE;
|
if(port_no >= rinfo.now_connect) return CELL_PAD_ERROR_NO_DEVICE;
|
||||||
|
|
||||||
Pad& pad = pads[port_no];
|
Pad& pad = pads[port_no];
|
||||||
CellPadData data;
|
CellPadData data = {};
|
||||||
memset(&data, 0, sizeof(CellPadData));
|
|
||||||
|
|
||||||
u16 d1Initial, d2Initial;
|
u16 d1Initial, d2Initial;
|
||||||
d1Initial = pad.m_digital_1;
|
d1Initial = pad.m_digital_1;
|
||||||
@ -301,8 +300,7 @@ int cellPadGetInfo(u32 info_addr)
|
|||||||
sys_io->Log("cellPadGetInfo(info_addr=0x%x)", info_addr);
|
sys_io->Log("cellPadGetInfo(info_addr=0x%x)", info_addr);
|
||||||
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
CellPadInfo info;
|
CellPadInfo info = {};
|
||||||
memset(&info, 0, sizeof(CellPadInfo));
|
|
||||||
|
|
||||||
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
||||||
info.max_connect = rinfo.max_connect;
|
info.max_connect = rinfo.max_connect;
|
||||||
@ -333,8 +331,7 @@ int cellPadGetInfo2(u32 info_addr)
|
|||||||
sys_io->Log("cellPadGetInfo2(info_addr=0x%x)", info_addr);
|
sys_io->Log("cellPadGetInfo2(info_addr=0x%x)", info_addr);
|
||||||
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
CellPadInfo2 info;
|
CellPadInfo2 info = {};
|
||||||
memset(&info, 0, sizeof(CellPadInfo2));
|
|
||||||
|
|
||||||
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
|
||||||
info.max_connect = rinfo.max_connect;
|
info.max_connect = rinfo.max_connect;
|
||||||
@ -370,8 +367,7 @@ int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr)
|
|||||||
|
|
||||||
const std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
const std::vector<Pad>& pads = Emu.GetPadManager().GetPads();
|
||||||
|
|
||||||
CellCapabilityInfo data;
|
CellCapabilityInfo data = {};
|
||||||
memset(&data, 0, sizeof(CellCapabilityInfo));
|
|
||||||
|
|
||||||
//Should return the same as device capability mask, psl1ght has it backwards in pad.h
|
//Should return the same as device capability mask, psl1ght has it backwards in pad.h
|
||||||
data.info[0] = pads[port_no].m_device_capability;
|
data.info[0] = pads[port_no].m_device_capability;
|
||||||
|
@ -21,6 +21,8 @@ static const bool g_is_u16 = Ini.AudioConvertToU16.GetValue();
|
|||||||
|
|
||||||
// libaudio Functions
|
// libaudio Functions
|
||||||
|
|
||||||
|
#define BUFFER_NUM 32
|
||||||
|
#define BUFFER_SIZE 256
|
||||||
int cellAudioInit()
|
int cellAudioInit()
|
||||||
{
|
{
|
||||||
cellAudio->Warning("cellAudioInit()");
|
cellAudio->Warning("cellAudioInit()");
|
||||||
@ -57,30 +59,25 @@ int cellAudioInit()
|
|||||||
if (Ini.AudioDumpToFile.GetValue())
|
if (Ini.AudioDumpToFile.GetValue())
|
||||||
m_dump.WriteHeader();
|
m_dump.WriteHeader();
|
||||||
|
|
||||||
float buf2ch[2 * 256]; // intermediate buffer for 2 channels
|
float buf2ch[2 * BUFFER_SIZE]; // intermediate buffer for 2 channels
|
||||||
float buf8ch[8 * 256]; // intermediate buffer for 8 channels
|
float buf8ch[8 * BUFFER_SIZE]; // intermediate buffer for 8 channels
|
||||||
|
|
||||||
uint oal_buffer_offset = 0;
|
uint oal_buffer_offset = 0;
|
||||||
const uint oal_buffer_size = sizeof(buf2ch) / sizeof(float);
|
const uint oal_buffer_size = 2 * BUFFER_SIZE;
|
||||||
|
|
||||||
std::unique_ptr<s16[]> oal_buffer[32];
|
std::unique_ptr<s16[]> oal_buffer[BUFFER_NUM];
|
||||||
SQueue<s16*, 31> queue;
|
std::unique_ptr<float[]> oal_buffer_float[BUFFER_NUM];
|
||||||
|
|
||||||
std::unique_ptr<float[]> oal_buffer_float[32];
|
for (u32 i = 0; i < BUFFER_NUM; i++)
|
||||||
SQueue<float*, 31> queue_float;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < sizeof(oal_buffer) / sizeof(oal_buffer[0]); i++)
|
|
||||||
{
|
{
|
||||||
oal_buffer[i] = std::unique_ptr<s16[]>(new s16[oal_buffer_size]);
|
oal_buffer[i] = std::unique_ptr<s16[]>(new s16[oal_buffer_size] {} );
|
||||||
memset(oal_buffer[i].get(), 0, oal_buffer_size * sizeof(s16));
|
oal_buffer_float[i] = std::unique_ptr<float[]>(new float[oal_buffer_size] {} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SQueue<s16*, 31> queue;
|
||||||
queue.Clear();
|
queue.Clear();
|
||||||
|
|
||||||
for (u32 i = 0; i < sizeof(oal_buffer_float) / sizeof(oal_buffer_float[0]); i++)
|
SQueue<float*, 31> queue_float;
|
||||||
{
|
|
||||||
oal_buffer_float[i] = std::unique_ptr<float[]>(new float[oal_buffer_size]);
|
|
||||||
memset(oal_buffer_float[i].get(), 0, oal_buffer_size * sizeof(float));
|
|
||||||
}
|
|
||||||
queue_float.Clear();
|
queue_float.Clear();
|
||||||
|
|
||||||
std::vector<u64> keys;
|
std::vector<u64> keys;
|
||||||
@ -89,10 +86,11 @@ int cellAudioInit()
|
|||||||
{
|
{
|
||||||
m_audio_out->Init();
|
m_audio_out->Init();
|
||||||
|
|
||||||
|
// Note: What if the ini value changes?
|
||||||
if (g_is_u16)
|
if (g_is_u16)
|
||||||
m_audio_out->Open(oal_buffer[0].get(), oal_buffer_size * sizeof(s16));
|
m_audio_out->Open(oal_buffer[0].get(), oal_buffer_size * sizeof(s16));
|
||||||
|
else
|
||||||
m_audio_out->Open(oal_buffer_float[0].get(), oal_buffer_size * sizeof(float));
|
m_audio_out->Open(oal_buffer_float[0].get(), oal_buffer_size * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_config.start_time = get_system_time();
|
m_config.start_time = get_system_time();
|
||||||
@ -108,34 +106,27 @@ int cellAudioInit()
|
|||||||
|
|
||||||
if (g_is_u16)
|
if (g_is_u16)
|
||||||
queue.Pop(oal_buffer);
|
queue.Pop(oal_buffer);
|
||||||
|
else
|
||||||
|
queue_float.Pop(oal_buffer_float);
|
||||||
|
|
||||||
queue_float.Pop(oal_buffer_float);
|
|
||||||
|
|
||||||
if (g_is_u16)
|
if (g_is_u16)
|
||||||
{
|
{
|
||||||
if (oal_buffer)
|
if (oal_buffer)
|
||||||
{
|
{
|
||||||
m_audio_out->AddData(oal_buffer, oal_buffer_size * sizeof(s16));
|
m_audio_out->AddData(oal_buffer, oal_buffer_size * sizeof(s16));
|
||||||
}
|
continue;
|
||||||
else
|
|
||||||
{
|
|
||||||
internal_finished = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oal_buffer_float)
|
if (oal_buffer_float)
|
||||||
{
|
{
|
||||||
m_audio_out->AddData(oal_buffer_float, oal_buffer_size * sizeof(float));
|
m_audio_out->AddData(oal_buffer_float, oal_buffer_size * sizeof(float));
|
||||||
}
|
continue;
|
||||||
else
|
|
||||||
{
|
|
||||||
internal_finished = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal_finished = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
iat.detach();
|
iat.detach();
|
||||||
@ -161,8 +152,8 @@ int cellAudioInit()
|
|||||||
|
|
||||||
m_config.counter++;
|
m_config.counter++;
|
||||||
|
|
||||||
const u32 oal_pos = m_config.counter % (sizeof(oal_buffer) / sizeof(oal_buffer[0]));
|
const u32 oal_pos = m_config.counter % BUFFER_NUM;
|
||||||
const u32 oal_pos_float = m_config.counter % (sizeof(oal_buffer_float) / sizeof(oal_buffer_float[0]));
|
const u32 oal_pos_float = m_config.counter % BUFFER_NUM;
|
||||||
|
|
||||||
if (Emu.IsPaused())
|
if (Emu.IsPaused())
|
||||||
{
|
{
|
||||||
|
@ -148,8 +148,7 @@ int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr)
|
|||||||
|
|
||||||
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
|
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
|
||||||
|
|
||||||
CellVideoOutState state;
|
CellVideoOutState state = {};
|
||||||
memset(&state, 0, sizeof(CellVideoOutState));
|
|
||||||
|
|
||||||
switch(videoOut)
|
switch(videoOut)
|
||||||
{
|
{
|
||||||
@ -246,8 +245,7 @@ int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr)
|
|||||||
|
|
||||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT;
|
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT;
|
||||||
|
|
||||||
CellVideoOutConfiguration config;
|
CellVideoOutConfiguration config = {};
|
||||||
memset(&config, 0, sizeof(CellVideoOutConfiguration));
|
|
||||||
|
|
||||||
switch(videoOut)
|
switch(videoOut)
|
||||||
{
|
{
|
||||||
@ -471,8 +469,7 @@ int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u3
|
|||||||
int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr)
|
int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr)
|
||||||
{
|
{
|
||||||
cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x,deviceIndex=0x%x,state_addr=0x%x)",audioOut,deviceIndex,state_addr);
|
cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x,deviceIndex=0x%x,state_addr=0x%x)",audioOut,deviceIndex,state_addr);
|
||||||
CellAudioOutState state;
|
CellAudioOutState state = {};
|
||||||
memset(&state, 0, sizeof(CellAudioOutState));
|
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
@ -541,8 +538,7 @@ int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr)
|
|||||||
|
|
||||||
if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT;
|
if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT;
|
||||||
|
|
||||||
CellAudioOutConfiguration config;
|
CellAudioOutConfiguration config = {};
|
||||||
memset(&config, 0, sizeof(CellAudioOutConfiguration));
|
|
||||||
|
|
||||||
switch(audioOut)
|
switch(audioOut)
|
||||||
{
|
{
|
||||||
|
@ -159,13 +159,11 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
|||||||
picInfo->reserved2 = 0;
|
picInfo->reserved2 = 0;
|
||||||
|
|
||||||
u64 stamp0 = get_system_time();
|
u64 stamp0 = get_system_time();
|
||||||
|
auto pY = std::unique_ptr<u8[]>{ new u8[w*h] }.get(); // color planes
|
||||||
u8* pY = (u8*)malloc(w*h); // color planes
|
auto pU = std::unique_ptr<u8[]>{ new u8[w*h/4] }.get();
|
||||||
u8* pU = (u8*)malloc(w*h/4);
|
auto pV = std::unique_ptr<u8[]>{ new u8[w*h/4] }.get();
|
||||||
u8* pV = (u8*)malloc(w*h/4);
|
auto pA = std::unique_ptr<u8[]>{ new u8[w*h] }.get();
|
||||||
u8* pA = (u8*)malloc(w*h);
|
auto res = std::unique_ptr<u32[]>{ new u32[ow*oh*4] }.get(); // RGBA interleaved output
|
||||||
u32* res = (u32*)malloc(ow*oh*4); // RGBA interleaved output
|
|
||||||
const u8 alpha = ctrlParam->outAlpha;
|
|
||||||
|
|
||||||
if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h))
|
if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h))
|
||||||
{
|
{
|
||||||
@ -185,7 +183,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
|||||||
Emu.Pause();
|
Emu.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(pA, alpha, w*h);
|
memset(pA, (const u8)ctrlParam->outAlpha, w*h);
|
||||||
|
|
||||||
u64 stamp1 = get_system_time();
|
u64 stamp1 = get_system_time();
|
||||||
|
|
||||||
@ -210,12 +208,6 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
|
|||||||
Emu.Pause();
|
Emu.Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pY);
|
|
||||||
free(pU);
|
|
||||||
free(pV);
|
|
||||||
free(pA);
|
|
||||||
free(res);
|
|
||||||
|
|
||||||
//ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)",
|
//ConLog.Write("cellVpostExec() perf (access=%d, getContext=%d, scale=%d, finalize=%d)",
|
||||||
//stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
|
//stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user