This commit is contained in:
Nekotekina 2014-01-12 13:35:10 +04:00
commit 4e8cd72e59
3 changed files with 74 additions and 63 deletions

View file

@ -4,7 +4,8 @@
#include "Emu/Audio/cellAudio.h" #include "Emu/Audio/cellAudio.h"
void cellAudio_init(); void cellAudio_init();
Module cellAudio(0x0011, cellAudio_init); void cellAudio_unload();
Module cellAudio(0x0011, cellAudio_init, nullptr, cellAudio_unload);
enum enum
{ {
@ -81,9 +82,9 @@ struct CellAudioPortConfig
struct CellAudioConfig //custom structure struct CellAudioConfig //custom structure
{ {
bool g_is_audio_initialized; bool m_is_audio_initialized;
bool g_is_audio_port_open; bool m_is_audio_port_open;
bool g_is_audio_port_started; bool m_is_audio_port_started;
}; };
CellAudioPortParam* m_param = new CellAudioPortParam; CellAudioPortParam* m_param = new CellAudioPortParam;
@ -95,55 +96,55 @@ typedef void * CellAANHandle;
struct CellSSPlayerConfig struct CellSSPlayerConfig
{ {
u32 channels; be_t<u32> channels;
u32 outputMode; be_t<u32> outputMode;
}; };
struct CellSSPlayerWaveParam struct CellSSPlayerWaveParam
{ {
void *addr; void *addr;
int format; be_t<s32> format;
u32 samples; be_t<u32> samples;
u32 loopStartOffset; be_t<u32> loopStartOffset;
u32 startOffset; be_t<u32> startOffset;
}; };
struct CellSSPlayerCommonParam struct CellSSPlayerCommonParam
{ {
u32 loopMode; be_t<u32> loopMode;
u32 attackMode; be_t<u32> attackMode;
}; };
struct CellSurMixerPosition struct CellSurMixerPosition
{ {
float x; be_t<float> x;
float y; be_t<float> y;
float z; be_t<float> z;
}; };
struct CellSSPlayerRuntimeInfo struct CellSSPlayerRuntimeInfo
{ {
float level; be_t<float> level;
float speed; be_t<float> speed;
CellSurMixerPosition position; CellSurMixerPosition position;
}; };
struct CellSurMixerConfig struct CellSurMixerConfig
{ {
s32 priority; be_t<s32> priority;
u32 chStrips1; be_t<u32> chStrips1;
u32 chStrips2; be_t<u32> chStrips2;
u32 chStrips6; be_t<u32> chStrips6;
u32 chStrips8; be_t<u32> chStrips8;
}; };
struct CellSurMixerChStripParam struct CellSurMixerChStripParam
{ {
u32 param; be_t<u32> param;
void *attribute; void *attribute;
int dBSwitch; be_t<s32> dBSwitch;
float floatVal; be_t<float> floatVal;
int intVal; be_t<s32> intVal;
}; };
CellSSPlayerWaveParam current_SSPlayerWaveParam; CellSSPlayerWaveParam current_SSPlayerWaveParam;
@ -164,31 +165,31 @@ struct CellSnd3KeyOnParam
u8 vel; u8 vel;
u8 pan; u8 pan;
u8 panEx; u8 panEx;
s32 addPitch; be_t<s32> addPitch;
}; };
struct CellSnd3VoiceBitCtx struct CellSnd3VoiceBitCtx
{ {
u32 core; //[CELL_SND3_MAX_CORE], unknown identifier be_t<u32> core; //[CELL_SND3_MAX_CORE], unknown identifier
}; };
struct CellSnd3RequestQueueCtx struct CellSnd3RequestQueueCtx
{ {
void *frontQueue; void *frontQueue;
u32 frontQueueSize; be_t<u32> frontQueueSize;
void *rearQueue; void *rearQueue;
u32 rearQueueSize; be_t<u32> rearQueueSize;
}; };
//libsynt2 datatypes //libsynt2 datatypes
struct CellSoundSynth2EffectAttr struct CellSoundSynth2EffectAttr
{ {
u16 core; be_t<u16> core;
u16 mode; be_t<u16> mode;
s16 depth_L; be_t<s16> depth_L;
s16 depth_R; be_t<s16> depth_R;
u16 delay; be_t<u16> delay;
u16 feedback; be_t<u16> feedback;
}; };
// libaudio Functions // libaudio Functions
@ -196,28 +197,26 @@ struct CellSoundSynth2EffectAttr
int cellAudioInit() int cellAudioInit()
{ {
cellAudio.Warning("cellAudioInit()"); cellAudio.Warning("cellAudioInit()");
if(m_config->g_is_audio_initialized == true) return CELL_AUDIO_ERROR_ALREADY_INIT; if(m_config->m_is_audio_initialized == true) return CELL_AUDIO_ERROR_ALREADY_INIT;
m_config->g_is_audio_initialized = true; m_config->m_is_audio_initialized = true;
return CELL_OK; return CELL_OK;
} }
int cellAudioQuit() int cellAudioQuit()
{ {
cellAudio.Warning("cellAudioQuit()"); cellAudio.Warning("cellAudioQuit()");
if (m_config->g_is_audio_initialized == false) return CELL_AUDIO_ERROR_NOT_INIT; if (m_config->m_is_audio_initialized == false) return CELL_AUDIO_ERROR_NOT_INIT;
m_config->g_is_audio_initialized = false; m_config->m_is_audio_initialized = false;
delete m_config;
return CELL_OK; return CELL_OK;
} }
int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum) int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
{ {
cellAudio.Warning("cellAudioPortOpen(audioParam_addr=0x%x,portNum_addr=0x%x)",audioParam.GetAddr(),portNum.GetAddr()); cellAudio.Warning("cellAudioPortOpen(audioParam_addr=0x%x,portNum_addr=0x%x)",audioParam.GetAddr(),portNum.GetAddr());
UNIMPLEMENTED_FUNC(cellAudio);
if(!audioParam.IsGood() || !portNum.IsGood()) return CELL_AUDIO_ERROR_PORT_OPEN; if(!audioParam.IsGood() || !portNum.IsGood()) return CELL_AUDIO_ERROR_PORT_OPEN;
m_config->g_is_audio_port_open = true; m_config->m_is_audio_port_open = true;
m_param->nChannel = audioParam->nChannel; m_param->nChannel = audioParam->nChannel;
m_param->nBlock = audioParam->nBlock; m_param->nBlock = audioParam->nBlock;
@ -235,20 +234,22 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfi
if(!portConfig.IsGood()) if(!portConfig.IsGood())
{ {
return CELL_AUDIO_ERROR_PARAM; return CELL_AUDIO_ERROR_PARAM;
}; }
//if(portNum > 7) return CELL_AUDIO_ERROR_PORT_FULL; //if(portNum > 7) return CELL_AUDIO_ERROR_PORT_FULL;
if(m_config->g_is_audio_port_open == false) if(m_config->m_is_audio_port_open == false)
{ {
portConfig->status = CELL_AUDIO_STATUS_CLOSE; portConfig->status = CELL_AUDIO_STATUS_CLOSE;
return CELL_OK; return CELL_OK;
}; }
if(m_config->g_is_audio_port_started == true) if(m_config->m_is_audio_port_started == true)
{
portConfig->status = CELL_AUDIO_STATUS_RUN; portConfig->status = CELL_AUDIO_STATUS_RUN;
}
else else
{
portConfig->status = CELL_AUDIO_STATUS_READY; portConfig->status = CELL_AUDIO_STATUS_READY;
portConfig->nChannel = m_param->nChannel; portConfig->nChannel = m_param->nChannel;
portConfig->nBlock = m_param->nBlock; portConfig->nBlock = m_param->nBlock;
@ -258,36 +259,41 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfi
// portAddr - readIndexAddr == 0xFFF0 on ps3 // portAddr - readIndexAddr == 0xFFF0 on ps3
Memory.Write64(portConfig->readIndexAddr, 1); Memory.Write64(portConfig->readIndexAddr, 1);
return CELL_OK; }
return CELL_OK;
} }
int cellAudioPortStart(u32 portNum) int cellAudioPortStart(u32 portNum)
{ {
cellAudio.Warning("cellAudioPortStart(portNum=0x%x)",portNum); cellAudio.Warning("cellAudioPortStart(portNum=0x%x)",portNum);
if (m_config->g_is_audio_port_open == false) return CELL_AUDIO_ERROR_PORT_NOT_OPEN; if (m_config->m_is_audio_port_open == true)
m_config->g_is_audio_port_started = true; return CELL_AUDIO_ERROR_PORT_OPEN;
m_config->m_is_audio_port_started = true;
return CELL_OK; return CELL_OK;
} }
int cellAudioPortClose(u32 portNum) int cellAudioPortClose(u32 portNum)
{ {
cellAudio.Warning("cellAudioPortClose(portNum=0x%x)",portNum); cellAudio.Warning("cellAudioPortClose(portNum=0x%x)",portNum);
if (m_config->g_is_audio_port_open == false) return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
m_config->g_is_audio_port_open = false; if (m_config->m_is_audio_port_open == false)
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
UNIMPLEMENTED_FUNC(cellAudio);
m_config->m_is_audio_port_open = false;
return CELL_OK; return CELL_OK;
} }
int cellAudioPortStop(u32 portNum) int cellAudioPortStop(u32 portNum)
{ {
cellAudio.Warning("cellAudioPortStop(portNum=0x%x)",portNum); cellAudio.Warning("cellAudioPortStop(portNum=0x%x)",portNum);
if (m_config->g_is_audio_port_started == false) return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
m_config->g_is_audio_port_started = false; if (m_config->m_is_audio_port_started == false)
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
UNIMPLEMENTED_FUNC(cellAudio);
m_config->m_is_audio_port_started = false;
return CELL_OK; return CELL_OK;
} }
@ -1006,3 +1012,10 @@ void cellAudio_init()
//TODO: Find addresses for libmixer, libsnd3 and libsynth2 functions //TODO: Find addresses for libmixer, libsnd3 and libsynth2 functions
} }
void cellAudio_unload()
{
m_config->m_is_audio_initialized = false;
m_config->m_is_audio_port_open = false;
m_config->m_is_audio_port_started = false;
}

View file

@ -1,6 +1,5 @@
#include "stdafx.h" #include "stdafx.h"
#include "MemoryViewer.h" #include "MemoryViewer.h"
#include "Emu/Memory/Memory.h"
MemoryViewerPanel::MemoryViewerPanel(wxWindow* parent) MemoryViewerPanel::MemoryViewerPanel(wxWindow* parent)
: wxFrame(parent, wxID_ANY, "Memory Viewer", wxDefaultPosition, wxSize(700, 450)) : wxFrame(parent, wxID_ANY, "Memory Viewer", wxDefaultPosition, wxSize(700, 450))

View file

@ -1,6 +1,5 @@
#include "stdafx.h" #include "stdafx.h"
#include "RSXDebugger.h" #include "RSXDebugger.h"
#include "Emu/Memory/Memory.h"
#include "Emu/GS/sysutil_video.h" #include "Emu/GS/sysutil_video.h"
#include "Emu/GS/GCM.h" #include "Emu/GS/GCM.h"
@ -26,7 +25,7 @@ RSXDebugger::RSXDebugger(wxWindow* parent)
wxBoxSizer& s_tools = *new wxBoxSizer(wxVERTICAL); wxBoxSizer& s_tools = *new wxBoxSizer(wxVERTICAL);
// Controls // Controls
wxStaticBoxSizer& s_controls = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Memory Viewer Options"); wxStaticBoxSizer& s_controls = *new wxStaticBoxSizer(wxHORIZONTAL, this, "RSX Debugger Controls");
// Controls: Address // Controls: Address
wxStaticBoxSizer& s_controls_addr = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Address:"); wxStaticBoxSizer& s_controls_addr = *new wxStaticBoxSizer(wxHORIZONTAL, this, "Address:");