diff --git a/rpcs3/Emu/Audio/cellAudio.h b/rpcs3/Emu/Audio/cellAudio.h index ff6e463065..b448dcfe16 100644 --- a/rpcs3/Emu/Audio/cellAudio.h +++ b/rpcs3/Emu/Audio/cellAudio.h @@ -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 diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index f302a9fc2f..8186beef87 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -527,6 +527,8 @@ int cellAudioPortOpen(vm::ptr audioParam, vm::ptr 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 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 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 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> src, u32 samples, float volume) +int cellAudioAddData(u32 portNum, vm::ptr 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 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> 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 lock(audioMutex); + + m_config.m_buffer = src.addr(); // TODO + return CELL_OK; } int cellAudioAdd6chData(u32 portNum, vm::ptr> 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 lock(audioMutex); + + m_config.m_buffer = src.addr(); // TODO + return CELL_OK; } diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 4c271aaac9..05adca06f5 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -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& 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); diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 06046cc1ce..b9a9d4b638 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -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; diff --git a/rpcs3/Gui/GLGSFrame.cpp b/rpcs3/Gui/GLGSFrame.cpp index 8a0fc1aab7..c3f34c14eb 100644 --- a/rpcs3/Gui/GLGSFrame.cpp +++ b/rpcs3/Gui/GLGSFrame.cpp @@ -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(); } diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index 21c90077b3..b0b968b7e9 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -157,7 +157,7 @@ public: { list->DeleteAllItems(); list->SetImageList(m_img_list, wxIMAGE_LIST_SMALL); - for(int c=0; cGetColumnCount(); ++c) + for(int c=1; cGetColumnCount(); ++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]); } }