Merge pull request #915 from O1L/master

Show more information in GSFrame title, some changes in cellAudio
This commit is contained in:
B1ackDaemon 2014-12-21 19:52:40 +02:00
commit 0011a50c0b
6 changed files with 130 additions and 9 deletions

View File

@ -82,6 +82,8 @@ struct AudioPortConfig
u64 attr;
u64 tag;
u64 counter; // copy of global counter
u32 addr;
u32 read_index_addr;
};
struct AudioConfig //custom structure

View File

@ -527,6 +527,8 @@ int cellAudioPortOpen(vm::ptr<CellAudioPortParam> audioParam, vm::ptr<u32> portN
port.channel = (u8)audioParam->nChannel;
port.block = (u8)audioParam->nBlock;
port.attr = audioParam->attr;
port.addr = m_config.m_buffer + (128 * 1024 * i);
port.read_index_addr = m_config.m_indexes + (sizeof(u64) * i);
if (port.attr & CELL_AUDIO_PORTATTR_INITLEVEL)
{
port.level = audioParam->level;
@ -579,8 +581,8 @@ int cellAudioGetPortConfig(u32 portNum, vm::ptr<CellAudioPortConfig> portConfig)
portConfig->nChannel = port.channel;
portConfig->nBlock = port.block;
portConfig->portSize = port.channel * port.block * 256 * sizeof(float);
portConfig->portAddr = m_config.m_buffer + (128 * 1024 * portNum); // 0x20020000
portConfig->readIndexAddr = m_config.m_indexes + (sizeof(u64) * portNum); // 0x20010010 on ps3
portConfig->portAddr = port.addr; // 0x20020000
portConfig->readIndexAddr = port.read_index_addr; // 0x20010010 on ps3
cellAudio->Log("*** port config: nChannel=%d, nBlock=%d, portSize=0x%x, portAddr=0x%x, readIndexAddr=0x%x",
(u32)portConfig->nChannel, (u32)portConfig->nBlock, (u32)portConfig->portSize, (u32)portConfig->portAddr, (u32)portConfig->readIndexAddr);
@ -731,6 +733,28 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<u64> tag)
int cellAudioSetPortLevel(u32 portNum, float level)
{
cellAudio->Todo("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level);
AudioPortConfig& port = m_config.m_ports[portNum];
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
return CELL_AUDIO_ERROR_PARAM;
}
if (!port.m_is_audio_port_opened)
{
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
}
if (!port.m_is_audio_port_started)
{
return CELL_AUDIO_ERROR_PORT_NOT_RUN;
}
std::lock_guard<std::mutex> lock(audioMutex);
port.level = level; // TODO
return CELL_OK;
}
@ -841,21 +865,94 @@ int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags)
return CELL_OK;
}
int cellAudioAddData(u32 portNum, vm::ptr<be_t<float>> src, u32 samples, float volume)
int cellAudioAddData(u32 portNum, vm::ptr<float> src, u32 samples, float volume)
{
cellAudio->Todo("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume);
AudioPortConfig& port = m_config.m_ports[portNum];
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
return CELL_AUDIO_ERROR_PARAM;
}
if (!port.m_is_audio_port_opened)
{
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
}
if (!port.m_is_audio_port_started)
{
return CELL_AUDIO_ERROR_PORT_NOT_RUN;
}
std::lock_guard<std::mutex> lock(audioMutex);
//u32 addr = port.addr;
//for (u32 i = 0; i < samples; i++)
//{
// vm::write32(addr, src[i]);
// addr += port.channel * port.block * sizeof(float);
//}
m_config.m_buffer = src.addr(); // TODO: write data from src in selected port
return CELL_OK;
}
int cellAudioAdd2chData(u32 portNum, vm::ptr<be_t<float>> src, u32 samples, float volume)
{
cellAudio->Todo("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.addr(), samples, volume);
AudioPortConfig& port = m_config.m_ports[portNum];
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
return CELL_AUDIO_ERROR_PARAM;
}
if (!port.m_is_audio_port_opened)
{
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
}
if (!port.m_is_audio_port_started)
{
return CELL_AUDIO_ERROR_PORT_NOT_RUN;
}
std::lock_guard<std::mutex> lock(audioMutex);
m_config.m_buffer = src.addr(); // TODO
return CELL_OK;
}
int cellAudioAdd6chData(u32 portNum, vm::ptr<be_t<float>> src, float volume)
{
cellAudio->Todo("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.addr(), volume);
AudioPortConfig& port = m_config.m_ports[portNum];
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
return CELL_AUDIO_ERROR_PARAM;
}
if (!port.m_is_audio_port_opened)
{
return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
}
if (!port.m_is_audio_port_started)
{
return CELL_AUDIO_ERROR_PORT_NOT_RUN;
}
std::lock_guard<std::mutex> lock(audioMutex);
m_config.m_buffer = src.addr(); // TODO
return CELL_OK;
}

View File

@ -101,6 +101,11 @@ void Emulator::SetTitleID(const std::string& id)
m_title_id = id;
}
void Emulator::SetTitle(const std::string& title)
{
m_title = title;
}
void Emulator::CheckStatus()
{
std::vector<CPUThread *>& threads = GetCPU().GetThreads();
@ -149,7 +154,7 @@ bool Emulator::BootGame(const std::string& path, bool direct, int device)
"/BOOT.BIN",
"/PS3_GAME/USRDIR/EBOOT.BIN",
"/USRDIR/EBOOT.BIN",
"/EBOOT.BIN",
"/EBOOT.BIN"
};
auto curpath = path;
@ -228,7 +233,7 @@ void Emulator::Load()
}
LOG_NOTICE(LOADER, " ");//used to be skip_line
vfsFile sfo("/app_home/../PARAM.SFO");
vfsFile sfo("/app_home/../../PARAM.SFO");
PSFLoader psf(sfo);
psf.Load(false);
std::string title = psf.GetString("TITLE");
@ -236,6 +241,9 @@ void Emulator::Load()
LOG_NOTICE(LOADER, "Title: %s", title.c_str());
LOG_NOTICE(LOADER, "Serial: %s", title_id.c_str());
title.length() ? SetTitle(title) : SetTitle(m_path);
SetTitleID(title_id);
// bdvd inserting imitation
vfsFile f1("/app_home/../dev_bdvd.path");
if (f1.IsOpened())
@ -271,7 +279,7 @@ void Emulator::Load()
}
// trying to load some info from PARAM.SFO
vfsFile f2("/app_home/../PARAM.SFO");
vfsFile f2("/app_home/../../PARAM.SFO");
if (f2.IsOpened())
{
PSFLoader psf(f2);

View File

@ -115,6 +115,7 @@ public:
std::string m_elf_path;
std::string m_emu_path;
std::string m_title_id;
std::string m_title;
s32 m_sdk_version;
Emulator();
@ -123,6 +124,7 @@ public:
void Init();
void SetPath(const std::string& path, const std::string& elf_path = "");
void SetTitleID(const std::string& id);
void SetTitle(const std::string& title);
std::string GetPath() const
{
@ -134,6 +136,16 @@ public:
return m_emu_path;
}
std::string GetTitleID() const
{
return m_title_id;
}
std::string GetTitle() const
{
return m_title;
}
void SetEmulatorPath(const std::string& path)
{
m_emu_path = path;

View File

@ -1,5 +1,6 @@
#include "stdafx_gui.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "GLGSFrame.h"
#include "Utilities/Timer.h"
@ -61,10 +62,12 @@ void GLGSFrame::Flip(void* context)
canvas->SwapBuffers();
m_frames++;
const std::string sub_title = Emu.GetTitle() += Emu.GetTitleID().length() ? " [" + Emu.GetTitleID() + "] | " : " | ";
if (fps_t.GetElapsedTimeInSec() >= 0.5)
{
// can freeze on exit
SetTitle(wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
SetTitle(sub_title + wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
m_frames = 0;
fps_t.Start();
}

View File

@ -157,7 +157,7 @@ public:
{
list->DeleteAllItems();
list->SetImageList(m_img_list, wxIMAGE_LIST_SMALL);
for(int c=0; c<list->GetColumnCount(); ++c)
for(int c=1; c<list->GetColumnCount(); ++c)
{
Column* col = GetColumnByPos(c);
@ -175,7 +175,6 @@ public:
list->SetItemData(i, i);
}
list->SetItem(i, c, fmt::FromUTF8(col->data[i]));
list->SetItem(i, 0, wxEmptyString); // don't insert icon path
list->SetItemColumnImage(i, 0, m_icon_indexes[i]);
}
}