From c37905e465b0d619b94daea21fb23bd48795d9e2 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Fri, 2 May 2014 08:30:32 +0200 Subject: [PATCH 1/5] initial start to eliminate static func init, not compilable atm move module initialization into a module manager, still has some issues like stopping not working and debug crashing add #idef 0 to modules that aren't in the windows project don't double initialize and don't de-initialize for now, since many modules don't expect it and it leads to many errors remove duplicate module lists for empty modules and implemented ones, make Module non-copyable but movable add secondary project, no real use for it now add some memleak config to the emucore and add asmjit path to rpcs3 small rebase error fixed to get it to compile again add filters for emucore re-add the module manager and static file WIP commit, linker errors abound some more abstraction layer stuff fix the remaining linker errors, re-enable platform specific mouse, pad and keyboard handlers rebasing fix memset undefined and re() usage of se_t before declaration Add wxGUI define by default for cmake builds fix copy constructors of Datetime header fix copy constructors of other wx interface classes remove static declarations of global variables make wxGLCanvas constructor non-ambiguous even with wx2.8. compat mode, fix wrong std::exception constructor calls remove duplicate definition for FromUTF8 and ToUTF8 temp changes --- Utilities/BEType.h | 12 + Utilities/IdManager.h | 4 +- Utilities/StrFmt.cpp | 74 +- Utilities/StrFmt.h | 60 ++ Utilities/Thread.h | 4 +- Utilities/rConcurrency.cpp | 130 +++ Utilities/rConcurrency.h | 59 ++ Utilities/rFile.cpp | 327 ++++++ Utilities/rFile.h | 84 ++ Utilities/rMsgBox.cpp | 51 + Utilities/rMsgBox.h | 47 + Utilities/rPlatform.cpp | 165 +++ Utilities/rPlatform.h | 114 ++ Utilities/rTime.cpp | 261 +++++ Utilities/rTime.h | 102 ++ Utilities/rXml.cpp | 101 ++ Utilities/rXml.h | 30 + asmjitsrc/asmjit.vcxproj | 10 +- rpcs3.sln | 13 + rpcs3/CMakeLists.txt | 2 + rpcs3/Crypto/unedat.cpp | 14 +- rpcs3/Crypto/unpkg.cpp | 24 +- rpcs3/Crypto/unpkg.h | 2 +- rpcs3/Crypto/unself.cpp | 12 +- rpcs3/Emu/ARMv7/ARMv7DisAsm.h | 1 - rpcs3/Emu/Audio/AudioDumper.cpp | 2 +- rpcs3/Emu/Audio/AudioDumper.h | 2 +- rpcs3/Emu/CPU/CPUThread.cpp | 58 +- rpcs3/Emu/CPU/CPUThread.h | 6 +- rpcs3/Emu/CPU/CPUThreadManager.cpp | 8 +- rpcs3/Emu/CPU/CPUThreadManager.h | 2 +- rpcs3/Emu/Cell/PPCDisAsm.h | 1 - rpcs3/Emu/Cell/PPCThread.cpp | 1 - rpcs3/Emu/Cell/PPUDisAsm.h | 1 - rpcs3/Emu/Cell/PPUInterpreter.h | 6 +- rpcs3/Emu/Cell/PPUProgramCompiler.cpp | 12 +- rpcs3/Emu/Cell/PPUThread.cpp | 2 +- rpcs3/Emu/Cell/PPUThread.h | 2 +- rpcs3/Emu/Cell/SPUDisAsm.h | 1 - rpcs3/Emu/Cell/SPURecompilerCore.cpp | 10 +- rpcs3/Emu/ConLog.h | 14 +- rpcs3/Emu/DbgCommand.cpp | 6 + rpcs3/Emu/DbgCommand.h | 40 + rpcs3/Emu/DbgConsole.cpp | 135 ++- rpcs3/Emu/DbgConsole.h | 110 +- rpcs3/Emu/FS/VFS.cpp | 12 +- rpcs3/Emu/FS/vfsDevice.cpp | 20 +- rpcs3/Emu/FS/vfsDirBase.cpp | 2 +- rpcs3/Emu/FS/vfsLocalDir.cpp | 18 +- rpcs3/Emu/FS/vfsLocalFile.cpp | 38 +- rpcs3/Emu/FS/vfsLocalFile.h | 2 +- rpcs3/Emu/GS/GCM.h | 2 +- rpcs3/Emu/GS/GL/GLGSRender.cpp | 62 +- rpcs3/Emu/GS/GL/GLGSRender.h | 47 +- rpcs3/Emu/GS/GL/GLVertexProgram.cpp | 2 +- rpcs3/Emu/GS/GSManager.cpp | 5 - rpcs3/Emu/GS/GSRender.cpp | 76 -- rpcs3/Emu/GS/GSRender.h | 28 - rpcs3/Emu/GS/Null/NullGSRender.h | 43 +- rpcs3/Emu/GS/RSXThread.cpp | 2 +- rpcs3/Emu/GS/RSXThread.h | 6 +- rpcs3/Emu/HDD/HDD.h | 2 +- rpcs3/Emu/Io/Keyboard.cpp | 16 +- rpcs3/Emu/Io/Mouse.cpp | 16 +- rpcs3/Emu/Io/Null/NullKeyboardHandler.h | 1 + rpcs3/Emu/Io/Null/NullMouseHandler.h | 1 + rpcs3/Emu/Io/Null/NullPadHandler.h | 1 + rpcs3/Emu/Io/Pad.cpp | 25 +- rpcs3/Emu/Memory/Memory.h | 7 - rpcs3/Emu/SysCalls/ModuleManager.cpp | 450 ++++++++ rpcs3/Emu/SysCalls/ModuleManager.h | 28 + rpcs3/Emu/SysCalls/Modules.cpp | 364 +------ rpcs3/Emu/SysCalls/Modules.h | 20 +- rpcs3/Emu/SysCalls/Modules/cellAdec.cpp | 47 +- rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp | 95 +- rpcs3/Emu/SysCalls/Modules/cellAudio.cpp | 91 +- rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellDmux.cpp | 99 +- rpcs3/Emu/SysCalls/Modules/cellFiber.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellFont.cpp | 167 +-- rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp | 17 +- rpcs3/Emu/SysCalls/Modules/cellGame.cpp | 53 +- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 358 +++---- rpcs3/Emu/SysCalls/Modules/cellGem.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp | 39 +- rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp | 45 +- rpcs3/Emu/SysCalls/Modules/cellL10n.cpp | 344 +++--- rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp | 27 +- rpcs3/Emu/SysCalls/Modules/cellOvis.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellPamf.cpp | 133 +-- .../Emu/SysCalls/Modules/cellPhotoDecode.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 88 +- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 155 +-- rpcs3/Emu/SysCalls/Modules/cellRtc.cpp | 335 +++--- rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp | 478 ++++----- rpcs3/Emu/SysCalls/Modules/cellSync.cpp | 21 +- rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp | 38 +- rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp | 305 +++--- rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp | 13 +- .../SysCalls/Modules/cellSysutil_SaveData.cpp | 14 +- rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp | 19 +- rpcs3/Emu/SysCalls/Modules/cellVdec.cpp | 65 +- rpcs3/Emu/SysCalls/Modules/cellVpost.cpp | 35 +- rpcs3/Emu/SysCalls/Modules/libmixer.cpp | 67 +- rpcs3/Emu/SysCalls/Modules/libsnd3.h | 2 - rpcs3/Emu/SysCalls/Modules/libsynth2.h | 4 +- rpcs3/Emu/SysCalls/Modules/sceNp.cpp | 71 +- rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp | 94 +- rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp | 127 +-- rpcs3/Emu/SysCalls/Modules/sys_fs.cpp | 105 +- rpcs3/Emu/SysCalls/Modules/sys_io.cpp | 73 +- rpcs3/Emu/SysCalls/Modules/sys_net.cpp | 157 +-- rpcs3/Emu/SysCalls/Static.cpp | 80 +- rpcs3/Emu/SysCalls/Static.h | 15 + rpcs3/Emu/SysCalls/SysCalls.cpp | 3 +- rpcs3/Emu/SysCalls/SysCalls.h | 11 +- rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp | 120 +-- rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp | 20 +- rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp | 16 +- rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp | 28 +- rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp | 30 +- rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp | 2 +- rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp | 4 +- rpcs3/Emu/SysCalls/lv2/SC_Timer.h | 2 +- rpcs3/Emu/System.cpp | 59 +- rpcs3/Emu/System.h | 21 +- rpcs3/Gui/ConLog.cpp | 155 --- rpcs3/Gui/DbgFrame.cpp | 94 ++ rpcs3/Gui/DbgFrame.h | 23 + rpcs3/Gui/GLGSFrame.cpp | 50 + rpcs3/Gui/GLGSFrame.h | 21 + rpcs3/Gui/GSFrame.cpp | 82 ++ rpcs3/Gui/GSFrame.h | 29 + rpcs3/Gui/MainFrame.cpp | 3 +- rpcs3/Gui/MainFrame.h | 3 +- rpcs3/Gui/RSXDebugger.h | 15 - rpcs3/Ini.cpp | 24 +- rpcs3/Ini.h | 2 +- rpcs3/Loader/ELF32.cpp | 6 +- rpcs3/Loader/ELF32.h | 6 +- rpcs3/Loader/ELF64.cpp | 16 +- rpcs3/Loader/ELF64.h | 6 +- rpcs3/Loader/Loader.h | 14 +- rpcs3/Loader/PKG.cpp | 12 +- rpcs3/Loader/PKG.h | 4 +- rpcs3/Loader/TROPUSR.cpp | 12 +- rpcs3/emucore.vcxproj | 506 +++++++++ rpcs3/emucore.vcxproj.filters | 926 ++++++++++++++++ rpcs3/emucore.vcxproj.user | 4 + rpcs3/rpcs3.cpp | 18 + rpcs3/rpcs3.h | 34 - rpcs3/rpcs3.vcxproj | 468 +-------- rpcs3/rpcs3.vcxproj.filters | 986 +----------------- rpcs3/rpcs3.vcxproj.user | 6 +- rpcs3/stdafx.cpp | 2 +- rpcs3/stdafx.h | 31 +- 156 files changed, 6567 insertions(+), 4611 deletions(-) create mode 100644 Utilities/rConcurrency.cpp create mode 100644 Utilities/rConcurrency.h create mode 100644 Utilities/rFile.cpp create mode 100644 Utilities/rFile.h create mode 100644 Utilities/rMsgBox.cpp create mode 100644 Utilities/rMsgBox.h create mode 100644 Utilities/rPlatform.cpp create mode 100644 Utilities/rPlatform.h create mode 100644 Utilities/rTime.cpp create mode 100644 Utilities/rTime.h create mode 100644 Utilities/rXml.cpp create mode 100644 Utilities/rXml.h create mode 100644 rpcs3/Emu/DbgCommand.cpp create mode 100644 rpcs3/Emu/DbgCommand.h create mode 100644 rpcs3/Emu/SysCalls/ModuleManager.cpp create mode 100644 rpcs3/Emu/SysCalls/ModuleManager.h create mode 100644 rpcs3/Emu/SysCalls/Static.h create mode 100644 rpcs3/Gui/DbgFrame.cpp create mode 100644 rpcs3/Gui/DbgFrame.h create mode 100644 rpcs3/Gui/GLGSFrame.cpp create mode 100644 rpcs3/Gui/GLGSFrame.h create mode 100644 rpcs3/Gui/GSFrame.cpp create mode 100644 rpcs3/Gui/GSFrame.h create mode 100644 rpcs3/emucore.vcxproj create mode 100644 rpcs3/emucore.vcxproj.filters create mode 100644 rpcs3/emucore.vcxproj.user diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 853fd32dec..cecb4cd3a6 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -2,12 +2,24 @@ #include "Utilities/GNU.h" +#include + +using std::min; +using std::max; + +//#define re(val) MemoryBase::Reverse(val) +#define re64(val) MemoryBase::Reverse64(val) +#define re32(val) MemoryBase::Reverse32(val) +#define re16(val) MemoryBase::Reverse16(val) + template struct se_t; template struct se_t { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } }; template struct se_t { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } }; +template T re(const T val) { T res; se_t::func(res, val); return res; } +template void re(T1& dst, const T2 val) { se_t::func(dst, val); } template struct const_se_t; template struct const_se_t diff --git a/Utilities/IdManager.h b/Utilities/IdManager.h index c56fefd061..9d72c65476 100644 --- a/Utilities/IdManager.h +++ b/Utilities/IdManager.h @@ -1,6 +1,8 @@ #pragma once #include +#define rID_ANY -1 // was wxID_ANY + typedef u32 ID_TYPE; class IDData @@ -154,7 +156,7 @@ public: { std::lock_guard lock(m_mtx_main); - if(id == wxID_ANY) + if(id == rID_ANY) return m_id_map.begin() != m_id_map.end(); } diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 2bd595992d..259b3c0ce3 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -54,21 +54,23 @@ std::string replace_all(std::string src, const std::string& from, const std::str return src; } -//convert a wxString to a std::string encoded in utf8 -//CAUTION, only use this to interface with wxWidgets classes -std::string fmt::ToUTF8(const wxString& right) -{ - auto ret = std::string(((const char *) right.utf8_str())); - return ret; -} - -//convert a std::string encoded in utf8 to a wxString -//CAUTION, only use this to interface with wxWidgets classes -wxString fmt::FromUTF8(const std::string& right) -{ - auto ret = wxString::FromUTF8(right.c_str()); - return ret; -} +//#ifdef wxGUI +////convert a wxString to a std::string encoded in utf8 +////CAUTION, only use this to interface with wxWidgets classes +//std::string fmt::ToUTF8(const wxString& right) +//{ +// auto ret = std::string(((const char *) right.utf8_str())); +// return ret; +//} +// +////convert a std::string encoded in utf8 to a wxString +////CAUTION, only use this to interface with wxWidgets classes +//wxString fmt::FromUTF8(const std::string& right) +//{ +// auto ret = wxString::FromUTF8(right.c_str()); +// return ret; +//} +//#endif //TODO: remove this after every snippet that uses it is gone //WARNING: not fully compatible with CmpNoCase from wxString @@ -86,4 +88,46 @@ int fmt::CmpNoCase(const std::string& a, const std::string& b) [](const char& a, const char& b){return tolower(a) == tolower(b); }) ? 0 : -1; } +} + +//TODO: remove this after every snippet that uses it is gone +//WARNING: not fully compatible with CmpNoCase from wxString +void fmt::Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm) +{ + size_t cursor = 0; + do + { + cursor = str.find(searchterm, cursor); + if (cursor != std::string::npos) + { + str.replace(cursor, searchterm.size(), replaceterm); + cursor += replaceterm.size(); + } + else + { + break; + } + } while (true); +} + +std::vector fmt::rSplit(const std::string& source, const std::string& delim) +{ + std::vector ret; + size_t cursor = 0; + do + { + size_t prevcurs = cursor; + cursor = source.find(delim, cursor); + if (cursor != std::string::npos) + { + ret.push_back(source.substr(prevcurs,cursor-prevcurs)); + cursor += delim.size(); + } + else + { + ret.push_back(source.substr(prevcurs)); + break; + } + } while (true); + return ret; } \ No newline at end of file diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 8aa2f897b8..9b4892b959 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -9,6 +9,29 @@ #define snprintf _snprintf #endif + + +//int CmpNoCase(const std::string &str, const std::string &str2) +//{ +// bool same; +// if (str.size() > str2.size()) +// { +// same = std::equal(str.cbegin(), str.cend(), str2.cbegin(), [](const char a, const char b) -> bool{ return tolower(a) == tolower(b); }); +// } +// else +// { +// same = std::equal(str2.cbegin(), str2.cend(), str.cbegin(), [](const char a, const char b) -> bool{ return tolower(a) == tolower(b); }); +// } +// if (same) +// { +// return 0; +// } +// else +// { +// return 1; +// } +//} + namespace fmt{ using std::string; using std::ostream; @@ -18,6 +41,38 @@ namespace fmt{ extern const string placeholder; + template + std::string AfterLast(const std::string& source, T searchstr) + { + size_t search_pos = source.rfind(searchstr); + search_pos = search_pos == std::string::npos ? 0 : search_pos; + return source.substr(search_pos); + } + + template + std::string BeforeLast(const std::string& source, T searchstr) + { + size_t search_pos = source.rfind(searchstr); + search_pos = search_pos == std::string::npos ? 0 : search_pos; + return source.substr(0, search_pos); + } + + template + std::string AfterFirst(const std::string& source, T searchstr) + { + size_t search_pos = source.find(searchstr); + search_pos = search_pos == std::string::npos ? 0 : search_pos; + return source.substr(search_pos); + } + + template + std::string BeforeFirst(const std::string& source, T searchstr) + { + size_t search_pos = source.find(searchstr); + search_pos = search_pos == std::string::npos ? 0 : search_pos; + return source.substr(0, search_pos); + } + // write `fmt` from `pos` to the first occurence of `fmt::placeholder` to // the stream `os`. Then write `arg` to to the stream. If there's no // `fmt::placeholder` after `pos` everything in `fmt` after pos is written @@ -161,4 +216,9 @@ namespace fmt{ //WARNING: not fully compatible with CmpNoCase from wxString int CmpNoCase(const std::string& a, const std::string& b); + //TODO: remove this after every snippet that uses it is gone + //WARNING: not fully compatible with Replace from wxString + void Replace(std::string &str, const std::string &searchterm, const std::string& replaceterm); + + std::vector rSplit(const std::string& source, const std::string& delim); } diff --git a/Utilities/Thread.h b/Utilities/Thread.h index cba6bcbdf3..f081b89951 100644 --- a/Utilities/Thread.h +++ b/Utilities/Thread.h @@ -124,9 +124,9 @@ public: bool IsBusy() const { return m_busy; } }; -static __forceinline bool SemaphorePostAndWait(wxSemaphore& sem) +static __forceinline bool SemaphorePostAndWait(rSemaphore& sem) { - if(sem.TryWait() != wxSEMA_BUSY) return false; + if(sem.TryWait() != rSEMA_BUSY) return false; sem.Post(); sem.Wait(); diff --git a/Utilities/rConcurrency.cpp b/Utilities/rConcurrency.cpp new file mode 100644 index 0000000000..cf60ff69ca --- /dev/null +++ b/Utilities/rConcurrency.cpp @@ -0,0 +1,130 @@ +#include "stdafx.h" + +rSemaphore::rSemaphore() +{ + handle = reinterpret_cast(new wxSemaphore()); +} + +//rSemaphore::rSemaphore(rSemaphore& other) +//{ +// handle = reinterpret_cast(new wxSemaphore(*reinterpret_cast(other.handle))); +//} + +rSemaphore::~rSemaphore() +{ + delete reinterpret_cast(handle); +} + +rSemaphore::rSemaphore(int initial_count, int max_count) +{ + handle = reinterpret_cast(new wxSemaphore(initial_count,max_count)); +} + +void rSemaphore::Wait() +{ + reinterpret_cast(handle)->Wait(); +} + +rSemaStatus rSemaphore::TryWait() +{ + wxSemaError err = reinterpret_cast(handle)->TryWait(); + if (err == wxSEMA_BUSY) + { + return rSEMA_BUSY; + } + else + { + return rSEMA_OTHER; + } +} + +void rSemaphore::Post() +{ + reinterpret_cast(handle)->Post(); +} + +void rSemaphore::WaitTimeout(u64 timeout) +{ + reinterpret_cast(handle)->WaitTimeout(timeout); +} + +rCriticalSection::rCriticalSection() +{ + handle = reinterpret_cast(new wxCriticalSection()); +} + +//rCriticalSection::rCriticalSection(rCriticalSection&) +//{ +// handle = reinterpret_cast(new wxCriticalSection(*reinterpret_cast(other.handle))); +//} + +rCriticalSection::~rCriticalSection() +{ + delete reinterpret_cast(handle); +} + +void rCriticalSection::Enter() +{ + reinterpret_cast(handle)->Enter(); +} + +void rCriticalSection::Leave() +{ + reinterpret_cast(handle)->Leave(); +} + +rTimer::rTimer() +{ + handle = reinterpret_cast(new wxTimer()); +} + +//rTimer::rTimer(rTimer&) +//{ +// handle = reinterpret_cast(new wxTimer(*reinterpret_cast(other.handle))); +//} + +rTimer::~rTimer() +{ + delete reinterpret_cast(handle); +} + +void rTimer::Start() +{ + reinterpret_cast(handle)->Start(); +} + +void rTimer::Stop() +{ + reinterpret_cast(handle)->Stop(); +} + +void rSleep(u32 time) +{ + wxSleep(time); +} + +void rMicroSleep(u64 time) +{ + wxMicroSleep(time); +} + +rCriticalSectionLocker::rCriticalSectionLocker(const rCriticalSection &sec) +{ + handle = reinterpret_cast(new wxCriticalSectionLocker(*reinterpret_cast(sec.handle))); +} + + +rCriticalSectionLocker::~rCriticalSectionLocker() +{ + delete reinterpret_cast(handle); +} + +bool rThread::IsMain() +{ + return wxThread::IsMain(); +} + +void rYieldIfNeeded() +{ + wxYieldIfNeeded(); +} \ No newline at end of file diff --git a/Utilities/rConcurrency.h b/Utilities/rConcurrency.h new file mode 100644 index 0000000000..506e3fecd3 --- /dev/null +++ b/Utilities/rConcurrency.h @@ -0,0 +1,59 @@ +#pragma once + +enum rSemaStatus +{ + rSEMA_BUSY, + rSEMA_OTHER +}; +struct rSemaphore +{ + rSemaphore(); + rSemaphore(const rSemaphore& other) = delete; + ~rSemaphore(); + rSemaphore(int initial_count, int max_count); + void Wait(); + rSemaStatus TryWait(); + void Post(); + void WaitTimeout(u64 timeout); +private: + void *handle; +}; + +struct rCriticalSection +{ + rCriticalSection(); + rCriticalSection(const rCriticalSection& other) = delete; + ~rCriticalSection(); + void Enter(); + void Leave(); + void *handle; +}; + +struct rTimer +{ + rTimer(); + rTimer(const rTimer& other) = delete; + ~rTimer(); + void Start(); + void Stop(); +private: + void *handle; +}; + +void rSleep(u32 time); +void rMicroSleep(u64 time); + +struct rCriticalSectionLocker +{ + rCriticalSectionLocker(const rCriticalSection& other); + ~rCriticalSectionLocker(); +private: + void *handle; +}; + +struct rThread +{ + static bool IsMain(); +}; + +void rYieldIfNeeded(); \ No newline at end of file diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp new file mode 100644 index 0000000000..c05e8e9c8e --- /dev/null +++ b/Utilities/rFile.cpp @@ -0,0 +1,327 @@ +#include "stdafx.h" + +const int rPATH_MKDIR_FULL = wxPATH_MKDIR_FULL; + +//enum rSeekMode +//{ +// rFromStart, +// rFromCurrent, +// rFromEnd +//}; +// +// enum OpenMode +// { +// read, +// write, +// read_write, +// write_append, +// write_excl +// }; + +wxFile::OpenMode convertOpenMode(rFile::OpenMode open) +{ + wxFile::OpenMode mode; + switch (open) + { + case rFile::read: + mode = wxFile::read; + break; + case rFile::write: + mode = wxFile::write; + break; + case rFile::read_write: + mode = wxFile::read_write; + break; + case rFile::write_append: + mode = wxFile::write_append; + break; + case rFile::write_excl: + mode = wxFile::write_excl; + break; + } + return mode; +} + +rFile::OpenMode rConvertOpenMode(wxFile::OpenMode open) +{ + rFile::OpenMode mode; + switch (open) + { + case wxFile::read: + mode = rFile::read; + break; + case wxFile::write: + mode = rFile::write; + break; + case wxFile::read_write: + mode = rFile::read_write; + break; + case wxFile::write_append: + mode = rFile::write_append; + break; + case wxFile::write_excl: + mode = rFile::write_excl; + break; + } + return mode; +} + +wxSeekMode convertSeekMode(rSeekMode mode) +{ + wxSeekMode ret; + switch (mode) + { + case rFromStart: + ret = wxFromStart; + break; + case rFromCurrent: + ret = wxFromCurrent; + break; + case rFromEnd: + ret = wxFromEnd; + break; + } + return ret; +} + +rSeekMode rConvertSeekMode(wxSeekMode mode) +{ + rSeekMode ret; + switch (mode) + { + case wxFromStart: + ret = rFromStart; + break; + case wxFromCurrent: + ret = rFromCurrent; + break; + case wxFromEnd: + ret = rFromEnd; + break; + } + return ret; +} + + +rFile::rFile() +{ + handle = reinterpret_cast(new wxFile()); +} + +rFile::rFile(const std::string& filename, rFile::OpenMode open) +{ + + handle = reinterpret_cast(new wxFile(fmt::FromUTF8(filename), convertOpenMode(open))); +} + +rFile::rFile(int fd) +{ + handle = reinterpret_cast(new wxFile(fd)); +} + +rFile::~rFile() +{ + delete reinterpret_cast(handle); +} + +bool rFile::Access(const std::string &filename, rFile::OpenMode mode) +{ + return wxFile::Access(fmt::FromUTF8(filename), convertOpenMode(mode)); +} + +size_t rFile::Write(const void *buffer, size_t count) +{ + return reinterpret_cast(handle)->Write(buffer,count); +} + +bool rFile::Write(const std::string &text) +{ + return reinterpret_cast(handle)->Write(fmt::FromUTF8(text)); +} + +bool rFile::Close() +{ + return reinterpret_cast(handle)->Close(); +} + +bool rFile::Create(const std::string &filename, bool overwrite, int access) +{ + return reinterpret_cast(handle)->Create(fmt::FromUTF8(filename),overwrite,access); +} + +bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access) +{ + return reinterpret_cast(handle)->Open(fmt::FromUTF8(filename), convertOpenMode(mode), access); +} + +bool rFile::Exists(const std::string &file) +{ + return wxFile::Exists(fmt::FromUTF8(file)); +} + +bool rFile::IsOpened() const +{ + return reinterpret_cast(handle)->IsOpened(); +} + +size_t rFile::Length() const +{ + return reinterpret_cast(handle)->Length(); +} + +size_t rFile::Read(void *buffer, size_t count) +{ + return reinterpret_cast(handle)->Read(buffer,count); +} + +size_t rFile::Seek(size_t ofs, rSeekMode mode) +{ + return reinterpret_cast(handle)->Seek(ofs, convertSeekMode(mode)); +} + +size_t rFile::Tell() const +{ + return reinterpret_cast(handle)->Tell(); +} + +std::string rGetCwd() +{ + return fmt::ToUTF8(wxGetCwd()); +} + +bool rMkdir(const std::string &path) +{ + return wxMkdir(fmt::FromUTF8(path)); +} + +bool rRmdir(const std::string &path) +{ + return wxRmdir(fmt::FromUTF8(path)); +} + +bool rDirExists(const std::string &path) +{ + return wxDirExists(fmt::FromUTF8(path)); +} + +bool rFileExists(const std::string &path) +{ + return wxFileExists(fmt::FromUTF8(path)); +} + +bool rRemoveFile(const std::string &path) +{ + return wxRemoveFile(fmt::FromUTF8(path)); +} + +bool rIsWritable(const std::string& path) +{ + return wxIsWritable(fmt::FromUTF8(path)); +} + +bool rIsReadable(const std::string& path) +{ + return wxIsReadable(fmt::FromUTF8(path)); +} + +bool rIsExecutable(const std::string& path) +{ + return wxIsExecutable(fmt::FromUTF8(path)); +} + +rDir::rDir() +{ + handle = reinterpret_cast(new wxDir()); +} + +rDir::~rDir() +{ + delete reinterpret_cast(handle); +} + +rDir::rDir(const std::string &path) +{ + handle = reinterpret_cast(new wxDir(fmt::FromUTF8(path))); +} + +bool rDir::Open(const std::string& path) +{ + return reinterpret_cast(handle)->Open(fmt::FromUTF8(path)); +} + +bool rDir::Exists(const std::string &path) +{ + return wxDir::Exists(fmt::FromUTF8(path)); +} + +bool rDir::GetFirst(std::string *filename) const +{ + wxString str; + bool res; + res = reinterpret_cast(handle)->GetFirst(&str); + *filename = str.ToStdString(); + return res; +} + +bool rDir::GetNext(std::string *filename) const +{ + wxString str; + bool res; + res = reinterpret_cast(handle)->GetNext(&str); + *filename = str.ToStdString(); + return res; +} + + + +rFileName::rFileName() +{ + handle = reinterpret_cast(new wxFileName()); +} + +rFileName::~rFileName() +{ + delete reinterpret_cast(handle); +} + +rFileName::rFileName(const rFileName& filename) +{ + handle = reinterpret_cast(new wxFileName(*reinterpret_cast(filename.handle))); +} + + +rFileName::rFileName(const std::string& name) +{ + handle = reinterpret_cast(new wxFileName(fmt::FromUTF8(name))); +} + +std::string rFileName::GetFullPath() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetFullPath()); +} + +std::string rFileName::GetPath() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetPath()); +} + +std::string rFileName::GetName() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetName()); +} + +std::string rFileName::GetFullName() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetFullName()); +} + +bool rFileName::Mkdir(const std::string& name, int permissions , int flags ) +{ + return wxFileName::Mkdir(fmt::FromUTF8(name), permissions, flags); +} + +bool rFileName::Normalize() +{ + return reinterpret_cast(handle)->Normalize(); +} + diff --git a/Utilities/rFile.h b/Utilities/rFile.h new file mode 100644 index 0000000000..cf4da0c284 --- /dev/null +++ b/Utilities/rFile.h @@ -0,0 +1,84 @@ +#pragma once + +#include + +extern const int rPATH_MKDIR_FULL; + +enum rSeekMode +{ + rFromStart, + rFromCurrent, + rFromEnd +}; + +class rFile +{ +public: + enum OpenMode + { + read, + write, + read_write, + write_append, + write_excl + }; + rFile(); + rFile(const rFile& other) = delete; + ~rFile(); + rFile(const std::string& filename, rFile::OpenMode open = rFile::read); + rFile(int fd); + static bool Access(const std::string &filename, rFile::OpenMode mode); + size_t Write(const void *buffer, size_t count); + bool Write(const std::string &text); + bool Close(); + bool Create(const std::string &filename, bool overwrite = false, int access = 0666); + bool Open(const std::string &filename, rFile::OpenMode mode = rFile::read, int access = 0666); + static bool Exists(const std::string&); + bool IsOpened() const; + size_t Length() const; + size_t Read(void *buffer, size_t count); + size_t Seek(size_t ofs, rSeekMode mode = rFromStart); + size_t Tell() const; + + void *handle; +}; + +std::string rGetCwd(); +bool rMkdir(const std::string &path); +bool rRmdir(const std::string &path); +bool rDirExists(const std::string &path); +bool rFileExists(const std::string &path); +bool rRemoveFile(const std::string &path); + +bool rIsWritable(const std::string& path); +bool rIsReadable(const std::string& path); +bool rIsExecutable(const std::string& path); + +struct rDir +{ + rDir(); + ~rDir(); + rDir(const rDir& other) = delete; + rDir(const std::string &path); + bool Open(const std::string& path); + static bool Exists(const std::string &path); + bool GetFirst(std::string *filename) const; + bool GetNext(std::string *filename) const; + + void *handle; +}; +struct rFileName +{ + rFileName(); + rFileName(const rFileName& other); + ~rFileName(); + rFileName(const std::string& name); + std::string GetFullPath(); + std::string GetPath(); + std::string GetName(); + std::string GetFullName(); + static bool Mkdir(const std::string& name, int permissions=0777, int flags=0); + bool Normalize(); + + void *handle; +}; diff --git a/Utilities/rMsgBox.cpp b/Utilities/rMsgBox.cpp new file mode 100644 index 0000000000..bdc9fa4b07 --- /dev/null +++ b/Utilities/rMsgBox.cpp @@ -0,0 +1,51 @@ +#include "stdafx.h" + + +std::string rMessageBoxCaptionStr = "Message"; + +rMessageDialog::rMessageDialog(void *parent, const std::string& msg, const std::string& title , long style ) +{ + handle = reinterpret_cast(new wxMessageDialog( + reinterpret_cast(parent) + , fmt::FromUTF8(msg) + , fmt::FromUTF8(title) + , style + )); +} + +rMessageDialog::~rMessageDialog() +{ + delete reinterpret_cast(handle); +} + +long rMessageDialog::ShowModal() +{ + return reinterpret_cast(handle)->ShowModal(); +} + +long rMessageBox(const std::string& message, const std::string& title, long style) +{ + return wxMessageBox(fmt::FromUTF8(message), fmt::FromUTF8(title),style); +} + +std::string dummyApp::GetAppName() +{ + if (handle) + { + return fmt::ToUTF8(reinterpret_cast(handle)->GetAppName()); + } + else + { + return "NULL"; + } +} +dummyApp::dummyApp() : handle(nullptr) +{ + +} +static dummyApp app; + +dummyApp& rGetApp() +{ + return app; +} \ No newline at end of file diff --git a/Utilities/rMsgBox.h b/Utilities/rMsgBox.h new file mode 100644 index 0000000000..354c850141 --- /dev/null +++ b/Utilities/rMsgBox.h @@ -0,0 +1,47 @@ +#pragma once + +extern std::string rMessageBoxCaptionStr;// = "Message"; + +enum MsgBoxParams : unsigned long +{ + rOK = 0x4 + , rYES =0x2//res + , rNO = 0x8 //res + , rID_YES = 5103 //resDialog + , rCANCEL = 0x10 + , rYES_NO = 0xA + , rHELP = 0x1000 + , rNO_DEFAULT = 0x80 + , rCANCEL_DEFAULT = 0x80000000 + , rYES_DEFAULT = 0x0 + , rOK_DEFAULT = 0x0 + , rICON_NONE = 0x40000 + , rICON_EXCLAMATION = 0x100 + , rICON_ERROR = 0x200 + , rICON_HAND = 0x200 + , rICON_QUESTION = 0x400 + , rICON_INFORMATION = 0x800 + , rICON_AUTH_NEEDED = 0x80000 + , rSTAY_ON_TOP = 0x8000 + , rCENTRE = 0x1 +}; + +struct rMessageDialog +{ + rMessageDialog(void *parent, const std::string& msg, const std::string& title = rMessageBoxCaptionStr, long style = rOK | rCENTRE); + rMessageDialog(const rMessageDialog& other) = delete; + ~rMessageDialog(); + long ShowModal(); + void *handle; +}; + +long rMessageBox(const std::string& message, const std::string& title,long style); + +struct dummyApp +{ + dummyApp(); + std::string GetAppName(); + void* handle; +}; + +dummyApp& rGetApp(); \ No newline at end of file diff --git a/Utilities/rPlatform.cpp b/Utilities/rPlatform.cpp new file mode 100644 index 0000000000..d309feb13e --- /dev/null +++ b/Utilities/rPlatform.cpp @@ -0,0 +1,165 @@ +#include "stdafx.h" + +#include +#include "Gui/GLGSFrame.h" + +#include "Emu/Io/Null/NullKeyboardHandler.h" +#include "Emu/Io/Windows/WindowsKeyboardHandler.h" + +#include "Emu/Io/Null/NullMouseHandler.h" +#include "Emu/Io/Windows/WindowsMouseHandler.h" + +#include "Emu/Io/Null/NullPadHandler.h" +#include "Emu/Io/Windows/WindowsPadHandler.h" + +rCanvas::rCanvas(void *parent) +{ + handle = static_cast(new wxGLCanvas(static_cast(parent),wxID_ANY,NULL)); +} + +rCanvas::~rCanvas() +{ + delete static_cast(handle); +} + +//void *rCanvas::GetCurrent() +//{ +// static_cast(handle)->GetCur; +//} + +bool rCanvas::SetCurrent(void *ctx) +{ + return static_cast(handle)->SetCurrent(*static_cast(ctx)); +} + + + + +rGLFrame::rGLFrame() +{ + handle = static_cast(new GLGSFrame()); +} + +rGLFrame::~rGLFrame() +{ + delete static_cast(handle); +} + +void rGLFrame::Close() +{ + static_cast(handle)->Close(); +} + +bool rGLFrame::IsShown() +{ + return static_cast(handle)->IsShown(); +} + +void rGLFrame::Hide() +{ + static_cast(handle)->Hide(); +} + +void rGLFrame::Show() +{ + static_cast(handle)->Show(); +} + + +void *rGLFrame::GetNewContext() +{ + return static_cast(new wxGLContext( + static_cast(handle)->GetCanvas() + )); +} + +void rGLFrame::Flip(void *ctx) +{ + static_cast(handle)->Flip( + static_cast(ctx)); +} + +void rGLFrame::SetCurrent(void *ctx) +{ + static_cast(handle)->GetCanvas()->SetCurrent(*static_cast(ctx)); +} + + +rImage::rImage() +{ + handle = static_cast(new wxImage()); +} + +rImage::~rImage() +{ + delete static_cast(handle); +} + +void rImage::Create(int width, int height, void *data, void *alpha) +{ + static_cast(handle)->Create(width, height, static_cast(data), static_cast(alpha)); +} +void rImage::SaveFile(const std::string& name, rImageType type) +{ + if (type == rBITMAP_TYPE_PNG) + { + static_cast(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG); + } + else + { + throw std::string("unsupported type"); + } +} + +int rPlatform::getKeyboardHandlerCount() +{ + return 2; +} + +KeyboardHandlerBase *rPlatform::getKeyboardHandler(int i) +{ + if (i == 0) + { + return new NullKeyboardHandler(); + } + else if (i == 1) + { + return new WindowsKeyboardHandler(); + } +} + +int rPlatform::getMouseHandlerCount() +{ + return 2; +} + + +MouseHandlerBase *rPlatform::getMouseHandler(int i) +{ + if (i == 0) + { + return new NullMouseHandler(); + } + else if (i == 1) + { + return new WindowsMouseHandler(); + } +} + +int rPlatform::getPadHandlerCount() +{ + return 2; +} + + +PadHandlerBase *rPlatform::getPadHandler(int i) +{ + if (i == 0) + { + return new NullPadHandler(); + } + else if (i == 1) + { + return new WindowsPadHandler(); + } +} \ No newline at end of file diff --git a/Utilities/rPlatform.h b/Utilities/rPlatform.h new file mode 100644 index 0000000000..040d1f3e1c --- /dev/null +++ b/Utilities/rPlatform.h @@ -0,0 +1,114 @@ +#pragma once +#include +#include + +//struct rGLContext; +#include "Emu/Io/Null/NullKeyboardHandler.h" +#include "Emu/Io/Null/NullMouseHandler.h" +#include "Emu/Io/Null/NullPadHandler.h" + +struct rCanvas +{ + rCanvas(void *parent); + rCanvas(const rCanvas &) = delete; + ~rCanvas(); + /*rGLContext*/void *GetCurrent(); + bool SetCurrent(/*rGLContext &*/ void *ctx); + + void *handle; +}; + +//struct rGLContext +//{ +// rGLContext(); +// rGLContext(rGLContext &) = delete; +// rGLContext(rCanvas *canvas); +// ~rGLContext(); +// +// void *handle; +//}; + +//struct rFrame +//{ +// rFrame(); +// rFrame(rFrame &) = delete; +// ~rFrame(); +// +// void Close(); +// bool IsShown(); +// void Hide(); +// void Show(); +// +// void *handle; +//}; + +struct rGLFrame/*: public rFrame*/ +{ + rGLFrame(); + rGLFrame(const rGLFrame &) = delete; + ~rGLFrame(); + + void Close(); + bool IsShown(); + void Hide(); + void Show(); + + void *handle; + + void SetCurrent( void *ctx); + //rCanvas *GetCanvas(); + void *GetNewContext(); + void Flip(/*rGLContext*/void *ctx); +}; + +struct rPlatform +{ + rGLFrame *getGLGSFrame(); + static rPlatform &getPlatform(); + + static int getKeyboardHandlerCount(); + static KeyboardHandlerBase *getKeyboardHandler(int i); + static int getMouseHandlerCount(); + static MouseHandlerBase *getMouseHandler(int i); + static int getPadHandlerCount(); + static PadHandlerBase *getPadHandler(int i); +}; + +/********************************************************************** +*********** RSX Debugger +************************************************************************/ + +struct RSXDebuggerProgram +{ + u32 id; + u32 vp_id; + u32 fp_id; + std::string vp_shader; + std::string fp_shader; + bool modified; + + RSXDebuggerProgram() + : modified(false) + { + } +}; + +extern std::vector m_debug_programs; + +/********************************************************************** +*********** Image stuff +************************************************************************/ +enum rImageType +{ + rBITMAP_TYPE_PNG +}; +struct rImage +{ + rImage(); + rImage(const rImage &) = delete; + ~rImage(); + void Create(int width , int height, void *data, void *alpha); + void SaveFile(const std::string& name, rImageType type); + + void *handle; +}; diff --git a/Utilities/rTime.cpp b/Utilities/rTime.cpp new file mode 100644 index 0000000000..aac6d514ab --- /dev/null +++ b/Utilities/rTime.cpp @@ -0,0 +1,261 @@ +#include "stdafx.h" + +#include + +std::string rDefaultDateTimeFormat = "%c"; + +rTimeSpan::rTimeSpan() +{ + handle = static_cast(new wxTimeSpan()); +} + +rTimeSpan::~rTimeSpan() +{ + delete static_cast(handle); +} + +rTimeSpan::rTimeSpan(const rTimeSpan& other) + +{ + handle = static_cast(new wxTimeSpan(*static_cast(other.handle))); + +} + +rTimeSpan::rTimeSpan(int a, int b , int c, int d) +{ + handle = static_cast(new wxTimeSpan(a,b,c,d)); +} + + +rDateSpan::rDateSpan() +{ + handle = static_cast(new wxDateSpan()); +} + +rDateSpan::~rDateSpan() +{ + delete static_cast(handle); +} + +rDateSpan::rDateSpan(const rDateSpan& other) +{ + handle = static_cast(new wxDateSpan(*static_cast(other.handle))); +} + +rDateSpan::rDateSpan(int a, int b, int c, int d) +{ + handle = static_cast(new wxDateSpan(a,b,c,d)); +} + + //enum TZ + //{ + // Local, GMT, UTC + //}; + //enum Calender + //{ + // Gregorian + //}; + + //struct rTimeZone + //{ + // rTimeZone(); + // rTimeZone(rDateTime::TZ timezone); + //}; + //struct WeekDay + //{ + // WeekDay(); + // WeekDay(int a); + //}; + //struct Month + //{ + // Month(); + // Month(int a); + //}; + +rDateTime::rDateTime() +{ + handle = static_cast(new wxDateTime()); +} + +rDateTime::~rDateTime() +{ + delete static_cast(handle); +} + +rDateTime::rDateTime(const rDateTime& other) +{ + handle = static_cast(new wxDateTime(*static_cast(other.handle))); +} + +rDateTime::rDateTime(const time_t& time) +{ + handle = static_cast(new wxDateTime(time)); +} + +rDateTime::rDateTime(u16 day, rDateTime::Month month, u16 year, u16 hour, u16 minute, u16 second, u32 millisecond) +{ + handle = static_cast(new wxDateTime(day,(wxDateTime::Month)month,year,hour,minute,second,millisecond)); +} + +rDateTime rDateTime::UNow() +{ + rDateTime time; + delete static_cast(time.handle); + time.handle = static_cast(new wxDateTime(wxDateTime::UNow())); + + return time; +} + +rDateTime rDateTime::FromUTC(bool val) +{ + rDateTime time(*this); + void *temp = time.handle; + + time.handle = static_cast(new wxDateTime(static_cast(temp)->FromTimezone(wxDateTime::GMT0, val))); + delete static_cast(temp); + + return time; +} + +rDateTime rDateTime::ToUTC(bool val) +{ + rDateTime time(*this); + void *temp = time.handle; + + time.handle = static_cast(new wxDateTime(static_cast(temp)->ToTimezone(wxDateTime::GMT0, val))); + delete static_cast(temp); + + return time; +} + +time_t rDateTime::GetTicks() +{ + return static_cast(handle)->GetTicks(); +} + +void rDateTime::Add(const rTimeSpan& span) +{ + static_cast(handle)->Add(*static_cast(span.handle)); +} + +void rDateTime::Add(const rDateSpan& span) +{ + static_cast(handle)->Add(*static_cast(span.handle)); +} + +//void rDateTime::Close() +//{ +// static_cast(handle)->Close(); +//} + +wxDateTime::TimeZone convertTZ(rDateTime::rTimeZone tz) +{ + switch (tz) + { + case rDateTime::Local: + return wxDateTime::Local; + case rDateTime::GMT0: + return wxDateTime::GMT0; + case rDateTime::UTC: + return wxDateTime::UTC; + default: + throw std::string("WRONG DATETIME"); + } +} + +std::string rDateTime::Format(const std::string &format, const rTimeZone &tz) const +{ + return fmt::ToUTF8(static_cast(handle)->Format(fmt::FromUTF8(format),convertTZ(tz))); +} + +void rDateTime::ParseDateTime(const std::string & format) +{ + /*return fmt::ToUTF8(*/static_cast(handle)->ParseDateTime(fmt::FromUTF8(format)); +} + +u32 rDateTime::GetAsDOS() +{ + return static_cast(handle)->GetAsDOS(); +} + +rDateTime &rDateTime::SetFromDOS(u32 fromdos) +{ + static_cast(handle)->SetFromDOS(fromdos); + return *this; +} + +bool rDateTime::IsLeapYear(int year, rDateTime::Calender cal) +{ + if (cal == Gregorian) + { + return wxDateTime::IsLeapYear(year, wxDateTime::Gregorian); + } + else + { + return wxDateTime::IsLeapYear(year, wxDateTime::Julian); + } +} + +int rDateTime::GetNumberOfDays(rDateTime::Month month, int year, rDateTime::Calender cal) +{ + if (cal == Gregorian) + { + return wxDateTime::GetNumberOfDays(static_cast(month), year, wxDateTime::Gregorian); + } + else + { + return wxDateTime::GetNumberOfDays(static_cast(month), year, wxDateTime::Julian); + } +} + +void rDateTime::SetToWeekDay(rDateTime::WeekDay day, int n, rDateTime::Month month, int year) +{ + static_cast(handle)->SetToWeekDay( + static_cast(day) + , n + , static_cast(month) + , year + ); +} + +int rDateTime::GetWeekDay() +{ + return static_cast(handle)->GetWeekDay(); +} + +u16 rDateTime::GetYear(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetYear(convertTZ(timezone)); +} + +u16 rDateTime::GetMonth(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetMonth(convertTZ(timezone)); +} + +u16 rDateTime::GetDay(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetDay(convertTZ(timezone)); +} + +u16 rDateTime::GetHour(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetHour(convertTZ(timezone)); +} + +u16 rDateTime::GetMinute(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetMinute(convertTZ(timezone)); +} + +u16 rDateTime::GetSecond(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetSecond(convertTZ(timezone)); +} + +u32 rDateTime::GetMillisecond(rDateTime::TZ timezone) +{ + return static_cast(handle)->GetMillisecond(convertTZ(timezone)); +} + + diff --git a/Utilities/rTime.h b/Utilities/rTime.h new file mode 100644 index 0000000000..8f62990382 --- /dev/null +++ b/Utilities/rTime.h @@ -0,0 +1,102 @@ +#pragma once + +extern std::string rDefaultDateTimeFormat; + + +struct rTimeSpan +{ + rTimeSpan(); + ~rTimeSpan(); + rTimeSpan(const rTimeSpan& other); + rTimeSpan(int, int, int, int); + + void *handle; +}; + +struct rDateSpan +{ + rDateSpan(); + ~rDateSpan(); + rDateSpan(const rDateSpan& other); + rDateSpan(int, int, int, int); + + void *handle; +}; + +struct rDateTime +{ + enum TZ + { + Local, GMT0,UTC + }; + enum Calender + { + Gregorian, Julian + }; + + using rTimeZone = TZ; + + enum WeekDay + { + Sun = 0, + Mon, + Tue, + Wed, + Thu, + Fri, + Sat, + Inv_WeekDay + }; + + enum Month { + Jan = 0, + Feb = 1, + Mar = 2, + Apr = 3, + May = 4, + Jun = 5, + Jul = 6, + Aug = 7, + Sep = 8, + Oct = 9, + Nov = 10, + Dec = 11, + Inv_Month = 12 + }; + + rDateTime(); + ~rDateTime(); + rDateTime(const rDateTime& other); + rDateTime(const time_t &time); + rDateTime(u16 day, rDateTime::Month month, u16 year, u16 hour, u16 minute, u16 second, u32 millisecond); + + static rDateTime UNow(); + rDateTime FromUTC(bool val); + rDateTime ToUTC(bool val); + time_t GetTicks(); + void Add(const rTimeSpan& span); + void Add(const rDateSpan& span); + void Close(); + std::string Format(const std::string &format = rDefaultDateTimeFormat, const rTimeZone &tz = Local) const; + + void ParseDateTime(const std::string & format); + + u32 GetAsDOS(); + rDateTime &SetFromDOS(u32 fromdos); + + static bool IsLeapYear(int year, rDateTime::Calender cal); + static int GetNumberOfDays(rDateTime::Month month, int year, rDateTime::Calender cal); + void SetToWeekDay(rDateTime::WeekDay day, int n, rDateTime::Month month, int year); + int GetWeekDay(); + + u16 GetYear( rDateTime::TZ timezone); + u16 GetMonth(rDateTime::TZ timezone); + u16 GetDay(rDateTime::TZ timezone); + u16 GetHour(rDateTime::TZ timezone); + u16 GetMinute(rDateTime::TZ timezone); + u16 GetSecond(rDateTime::TZ timezone); + u32 GetMillisecond(rDateTime::TZ timezone); + + void *handle; +}; + diff --git a/Utilities/rXml.cpp b/Utilities/rXml.cpp new file mode 100644 index 0000000000..089b88114d --- /dev/null +++ b/Utilities/rXml.cpp @@ -0,0 +1,101 @@ +#include "stdafx.h" + +#include + +#include + +rXmlNode::rXmlNode() +{ + ownPtr = true; + handle = reinterpret_cast(new wxXmlNode()); +} + +rXmlNode::rXmlNode(void *ptr) +{ + ownPtr = false; + handle = ptr; +} + +rXmlNode::rXmlNode(const rXmlNode& other) +{ + ownPtr = true; + handle = reinterpret_cast(new wxXmlNode(*reinterpret_cast(other.handle))); +} + +rXmlNode &rXmlNode::operator=(const rXmlNode& other) +{ + if (ownPtr) + { + delete reinterpret_cast(handle); + } + handle = reinterpret_cast(new wxXmlNode(*reinterpret_cast(other.handle))); + ownPtr = true; + return *this; +} + +rXmlNode::~rXmlNode() +{ + if (ownPtr) + { + delete reinterpret_cast(handle); + } +} + +std::shared_ptr rXmlNode::GetChildren() +{ + wxXmlNode* result = reinterpret_cast(handle)->GetChildren(); + return std::make_shared(reinterpret_cast(result)); +} + +std::shared_ptr rXmlNode::GetNext() +{ + wxXmlNode* result = reinterpret_cast(handle)->GetNext(); + return std::make_shared(reinterpret_cast(result)); +} + +std::string rXmlNode::GetName() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetName()); +} + +std::string rXmlNode::GetAttribute(const std::string &name) +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetAttribute(fmt::FromUTF8(name))); +} + +std::string rXmlNode::GetNodeContent() +{ + return fmt::ToUTF8(reinterpret_cast(handle)->GetNodeContent()); +} + +rXmlDocument::rXmlDocument() +{ + handle = reinterpret_cast(new wxXmlDocument()); +} + +rXmlDocument::rXmlDocument(const rXmlDocument& other) +{ + handle = reinterpret_cast(new wxXmlDocument(*reinterpret_cast(other.handle))); +} + +rXmlDocument &rXmlDocument::operator = (const rXmlDocument& other) +{ + delete reinterpret_cast(handle); + handle = reinterpret_cast(new wxXmlDocument(*reinterpret_cast(other.handle))); + return *this; +} + +rXmlDocument::~rXmlDocument() +{ + delete reinterpret_cast(handle); +} + +void rXmlDocument::Load(const std::string & path) +{ + reinterpret_cast(handle)->Load(fmt::FromUTF8(path)); +} + +std::shared_ptr rXmlDocument::GetRoot() +{ + return std::make_shared(reinterpret_cast(reinterpret_cast(handle)->GetRoot())); +} diff --git a/Utilities/rXml.h b/Utilities/rXml.h new file mode 100644 index 0000000000..9531936f73 --- /dev/null +++ b/Utilities/rXml.h @@ -0,0 +1,30 @@ +#pragma once + +struct rXmlNode +{ + rXmlNode(); + rXmlNode(void *); + rXmlNode(const rXmlNode& other); + rXmlNode &operator=(const rXmlNode& other); + ~rXmlNode(); + std::shared_ptr GetChildren(); + std::shared_ptr GetNext(); + std::string GetName(); + std::string GetAttribute( const std::string &name); + std::string GetNodeContent(); + + void *handle; + bool ownPtr; +}; + +struct rXmlDocument +{ + rXmlDocument(); + rXmlDocument(const rXmlDocument& other); + rXmlDocument &operator=(const rXmlDocument& other); + ~rXmlDocument(); + void Load(const std::string & path); + std::shared_ptr GetRoot(); + + void *handle; +}; \ No newline at end of file diff --git a/asmjitsrc/asmjit.vcxproj b/asmjitsrc/asmjit.vcxproj index 28da0c7bdb..67b4f55262 100644 --- a/asmjitsrc/asmjit.vcxproj +++ b/asmjitsrc/asmjit.vcxproj @@ -69,14 +69,14 @@ StaticLibrary false v120 - true + false Unicode StaticLibrary false v120 - true + false Unicode @@ -151,6 +151,9 @@ true true + + false + @@ -166,6 +169,9 @@ true true + + false + diff --git a/rpcs3.sln b/rpcs3.sln index acba28bea4..c1eece25ed 100644 --- a/rpcs3.sln +++ b/rpcs3.sln @@ -1,11 +1,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.21005.1 +# Visual Studio Express 2013 for Windows Desktop +VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}" ProjectSection(ProjectDependencies) = postProject {CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {CD478F02-7550-58A5-E085-CE4BC0C0AD23} {067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D} + {C4A10229-4712-4BD2-B63E-50D93C67A038} = {C4A10229-4712-4BD2-B63E-50D93C67A038} {5C363C34-4741-7036-861C-2E2279CF552E} = {5C363C34-4741-7036-861C-2E2279CF552E} {23E1C437-A951-5943-8639-A17F3CF2E606} = {23E1C437-A951-5943-8639-A17F3CF2E606} {22B14659-C5B6-B775-868D-A49198FEAD4A} = {22B14659-C5B6-B775-868D-A49198FEAD4A} @@ -135,6 +138,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjitsrc\asmjit. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asmjit", "asmjit", "{E2A982F2-4B1A-48B1-8D77-A17A589C58D7}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vcxproj", "{C4A10229-4712-4BD2-B63E-50D93C67A038}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug - MemLeak|x64 = Debug - MemLeak|x64 @@ -186,6 +191,7 @@ Global {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.ActiveCfg = Debug|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Build.0 = Debug|x64 + {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Deploy.0 = Debug|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.ActiveCfg = Debug|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.Build.0 = Debug|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|x64 @@ -281,10 +287,17 @@ Global {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.ActiveCfg = Release|x64 {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.Build.0 = Release|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.ActiveCfg = Debug|x64 + {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug - MemLeak|x64.ActiveCfg = Debug|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.ActiveCfg = Debug|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|x64.Build.0 = Debug|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.Build.0 = Release|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.ActiveCfg = Debug|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Debug|x64.Build.0 = Debug|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.ActiveCfg = Release|x64 + {C4A10229-4712-4BD2-B63E-50D93C67A038}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 2a1c12f6b8..e278d9643a 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -11,6 +11,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() + add_definitions(-DwxGUI) #add_definitions(-D__WXGTK__) #add_definitions(-Wfatal-errors) add_definitions(-w) # TODO: remove me @@ -19,6 +20,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) add_definitions(-g) # Debugging!! add_definitions(-msse2) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_definitions(-DwxGUI) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") endif() diff --git a/rpcs3/Crypto/unedat.cpp b/rpcs3/Crypto/unedat.cpp index 3ca97bb917..f16525c7c7 100644 --- a/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/Crypto/unedat.cpp @@ -133,7 +133,7 @@ unsigned char* get_block_key(int block, NPD_HEADER *npd) } // EDAT/SDAT functions. -int decrypt_data(wxFile *in, wxFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool verbose) +int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, unsigned char* crypt_key, bool verbose) { // Get metadata info and setup buffers. int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size); @@ -338,7 +338,7 @@ static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd) return true; } -int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, wxFile *f, bool verbose) +int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFile *f, bool verbose) { f->Seek(0); unsigned char *header = new unsigned char[0xA0]; @@ -490,7 +490,7 @@ void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER * delete[] buf; } -bool extract_data(wxFile *input, wxFile *output, const char* input_file_name, unsigned char* devklic, unsigned char* rifkey, bool verbose) +bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsigned char* devklic, unsigned char* rifkey, bool verbose) { // Setup NPD and EDAT/SDAT structs. NPD_HEADER *NPD = new NPD_HEADER(); @@ -604,9 +604,9 @@ bool extract_data(wxFile *input, wxFile *output, const char* input_file_name, un int DecryptEDAT(const std::string& input_file_name, const std::string& output_file_name, int mode, const std::string& rap_file_name, unsigned char *custom_klic, bool verbose) { // Prepare the files. - wxFile input(input_file_name.c_str()); - wxFile output(output_file_name.c_str(), wxFile::write); - wxFile rap(rap_file_name.c_str()); + rFile input(input_file_name.c_str()); + rFile output(output_file_name.c_str(), rFile::write); + rFile rap(rap_file_name.c_str()); // Set keys (RIF and DEVKLIC). unsigned char rifkey[0x10]; @@ -682,7 +682,7 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi { input.Close(); output.Close(); - wxRemoveFile(output_file_name); + rRemoveFile(output_file_name); return 0; } diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index 44261f6d33..1192304f34 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -5,7 +5,7 @@ #include "Emu/ConLog.h" // Decryption. -bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header) +bool CheckHeader(rFile& pkg_f, PKGHeader* m_header) { if (m_header->pkg_magic != 0x7F504B47) { ConLog.Error("PKG: Not a package file!"); @@ -48,7 +48,7 @@ bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header) return true; } -bool LoadHeader(wxFile& pkg_f, PKGHeader* m_header) +bool LoadHeader(rFile& pkg_f, PKGHeader* m_header) { pkg_f.Seek(0); @@ -63,7 +63,7 @@ bool LoadHeader(wxFile& pkg_f, PKGHeader* m_header) return true; } -int Decrypt(wxFile& pkg_f, wxFile& dec_pkg_f, PKGHeader* m_header) +int Decrypt(rFile& pkg_f, rFile& dec_pkg_f, PKGHeader* m_header) { if (!LoadHeader(pkg_f, m_header)) return -1; @@ -135,7 +135,7 @@ int Decrypt(wxFile& pkg_f, wxFile& dec_pkg_f, PKGHeader* m_header) } // Unpacking. -bool LoadEntries(wxFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries) +bool LoadEntries(rFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries) { dec_pkg_f.Seek(0); dec_pkg_f.Read(m_entries, sizeof(PKGEntry) * m_header->file_count); @@ -148,7 +148,7 @@ bool LoadEntries(wxFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries) return true; } -bool UnpackEntry(wxFile& dec_pkg_f, const PKGEntry& entry, std::string dir) +bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir) { u8 buf[BUF_SIZE]; @@ -163,8 +163,8 @@ bool UnpackEntry(wxFile& dec_pkg_f, const PKGEntry& entry, std::string dir) case PKG_FILE_ENTRY_SDAT: case PKG_FILE_ENTRY_REGULAR: { - wxFile out; - out.Create(dir + buf); + rFile out; + out.Create(dir + std::string(reinterpret_cast(buf), entry.name_size)); dec_pkg_f.Seek(entry.file_offset); for (u64 size = 0; size < entry.file_size; ) { @@ -179,18 +179,18 @@ bool UnpackEntry(wxFile& dec_pkg_f, const PKGEntry& entry, std::string dir) break; case PKG_FILE_ENTRY_FOLDER: - wxMkdir(dir + buf); + rMkdir(dir + std::string(reinterpret_cast(buf), entry.name_size)); break; } return true; } -int Unpack(wxFile& pkg_f, std::string src, std::string dst) +int Unpack(rFile& pkg_f, std::string src, std::string dst) { PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader)); - wxFile dec_pkg_f; - std::string decryptedFile = wxGetCwd().ToStdString() + "/dev_hdd1/" + src + ".dec"; + rFile dec_pkg_f; + std::string decryptedFile = rGetCwd() + "/dev_hdd1/" + src + ".dec"; dec_pkg_f.Create(decryptedFile, true); @@ -199,7 +199,7 @@ int Unpack(wxFile& pkg_f, std::string src, std::string dst) dec_pkg_f.Close(); - wxFile n_dec_pkg_f(decryptedFile, wxFile::read); + rFile n_dec_pkg_f(decryptedFile, rFile::read); std::vector m_entries; m_entries.resize(m_header->file_count); diff --git a/rpcs3/Crypto/unpkg.h b/rpcs3/Crypto/unpkg.h index cb89f8dbee..6a0e7bda28 100644 --- a/rpcs3/Crypto/unpkg.h +++ b/rpcs3/Crypto/unpkg.h @@ -47,4 +47,4 @@ struct PKGEntry be_t pad; // Padding (zeros) }; -extern int Unpack(wxFile& dec_pkg_f, std::string src, std::string dst); \ No newline at end of file +extern int Unpack(rFile& dec_pkg_f, std::string src, std::string dst); \ No newline at end of file diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 60950e4c99..4ee7c41806 100644 --- a/rpcs3/Crypto/unself.cpp +++ b/rpcs3/Crypto/unself.cpp @@ -389,7 +389,7 @@ bool SELFDecrypter::DecryptData() bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32) { // Create a new ELF file. - wxFile e(elf.c_str(), wxFile::write); + rFile e(elf.c_str(), rFile::write); if(!e.IsOpened()) { ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); @@ -505,17 +505,17 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key) // Try to find a matching RAP file under dev_usb000. std::string ci_str((const char *)content_id); - std::string rap_path(fmt::ToUTF8(wxGetCwd()) + "/dev_usb000/" + ci_str + ".rap"); + std::string rap_path(rGetCwd() + "/dev_usb000/" + ci_str + ".rap"); // Check if we have a valid RAP file. - if (!wxFile::Exists(fmt::FromUTF8(rap_path))) + if (!rFile::Exists(rap_path)) { ConLog.Error("This application requires a valid RAP file for decryption!"); return false; } // Open the RAP file and read the key. - wxFile rap_file(fmt::FromUTF8(rap_path), wxFile::read); + rFile rap_file(rap_path, rFile::read); if (!rap_file.IsOpened()) { @@ -569,7 +569,7 @@ bool IsSelfElf32(const std::string& path) bool CheckDebugSelf(const std::string& self, const std::string& elf) { // Open the SELF file. - wxFile s(fmt::FromUTF8(self)); + rFile s(self); if(!s.IsOpened()) { @@ -597,7 +597,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf) s.Seek(elf_offset); // Write the real ELF file back. - wxFile e(fmt::FromUTF8(elf), wxFile::write); + rFile e(elf, rFile::write); if(!e.IsOpened()) { ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); diff --git a/rpcs3/Emu/ARMv7/ARMv7DisAsm.h b/rpcs3/Emu/ARMv7/ARMv7DisAsm.h index 1ccba0dc1b..03f99be552 100644 --- a/rpcs3/Emu/ARMv7/ARMv7DisAsm.h +++ b/rpcs3/Emu/ARMv7/ARMv7DisAsm.h @@ -1,7 +1,6 @@ #pragma once #include "Emu/ARMv7/ARMv7Opcodes.h" #include "Emu/CPU/CPUDisAsm.h" -#include "Gui/DisAsmFrame.h" #include "Emu/Memory/Memory.h" static const char* g_arm_cond_name[16] = diff --git a/rpcs3/Emu/Audio/AudioDumper.cpp b/rpcs3/Emu/Audio/AudioDumper.cpp index 1a2e61fea2..3187c3b4be 100644 --- a/rpcs3/Emu/Audio/AudioDumper.cpp +++ b/rpcs3/Emu/Audio/AudioDumper.cpp @@ -11,7 +11,7 @@ AudioDumper::~AudioDumper() bool AudioDumper::Init() { - return m_output.Open("audio.wav", wxFile::write); + return m_output.Open("audio.wav", rFile::write); } void AudioDumper::WriteHeader() diff --git a/rpcs3/Emu/Audio/AudioDumper.h b/rpcs3/Emu/Audio/AudioDumper.h index 11a2f6e7e9..e554b95eca 100644 --- a/rpcs3/Emu/Audio/AudioDumper.h +++ b/rpcs3/Emu/Audio/AudioDumper.h @@ -55,7 +55,7 @@ class AudioDumper { private: WAVHeader m_header; - wxFile m_output; + rFile m_output; public: AudioDumper(u8 ch); diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index cd8c35ad60..e6c7a09cb0 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -4,7 +4,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3/Ini.h" -#include "rpcs3.h" #include "CPUThread.h" @@ -86,13 +85,13 @@ void CPUThread::SetName(const std::string& name) void CPUThread::Wait(bool wait) { - wxCriticalSectionLocker lock(m_cs_sync); + rCriticalSectionLocker lock(m_cs_sync); m_sync_wait = wait; } void CPUThread::Wait(const CPUThread& thr) { - wxCriticalSectionLocker lock(m_cs_sync); + rCriticalSectionLocker lock(m_cs_sync); m_wait_thread_id = thr.GetId(); m_sync_wait = true; } @@ -178,13 +177,13 @@ void CPUThread::SetError(const u32 error) } } -wxArrayString CPUThread::ErrorToString(const u32 error) +std::vector CPUThread::ErrorToString(const u32 error) { - wxArrayString earr; + std::vector earr; if(error == 0) return earr; - earr.Add("Unknown error"); + earr.push_back("Unknown error"); return earr; } @@ -196,9 +195,7 @@ void CPUThread::Run() Reset(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_START_THREAD, this); -#endif + SendDbgCommand(DID_START_THREAD, this); m_status = Running; @@ -208,18 +205,14 @@ void CPUThread::Run() DoRun(); Emu.CheckStatus(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STARTED_THREAD, this); -#endif + SendDbgCommand(DID_STARTED_THREAD, this); } void CPUThread::Resume() { if(!IsPaused()) return; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_RESUME_THREAD, this); -#endif + SendDbgCommand(DID_RESUME_THREAD, this); m_status = Running; DoResume(); @@ -227,36 +220,28 @@ void CPUThread::Resume() ThreadBase::Start(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_RESUMED_THREAD, this); -#endif + SendDbgCommand(DID_RESUMED_THREAD, this); } void CPUThread::Pause() { if(!IsRunning()) return; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); -#endif + SendDbgCommand(DID_PAUSE_THREAD, this); m_status = Paused; DoPause(); Emu.CheckStatus(); // ThreadBase::Stop(); // "Abort() called" exception -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this); -#endif + SendDbgCommand(DID_PAUSED_THREAD, this); } void CPUThread::Stop() { if(IsStopped()) return; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STOP_THREAD, this); -#endif + SendDbgCommand(DID_STOP_THREAD, this); m_status = Stopped; @@ -270,17 +255,13 @@ void CPUThread::Stop() Emu.CheckStatus(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this); -#endif + SendDbgCommand(DID_STOPED_THREAD, this); } void CPUThread::Exec() { m_is_step = false; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); -#endif + SendDbgCommand(DID_EXEC_THREAD, this); if(IsRunning()) ThreadBase::Start(); @@ -289,17 +270,14 @@ void CPUThread::Exec() void CPUThread::ExecOnce() { m_is_step = true; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this); -#endif + SendDbgCommand(DID_EXEC_THREAD, this); + m_status = Running; ThreadBase::Start(); ThreadBase::Stop(true,false); m_status = Paused; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); - wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this); -#endif + SendDbgCommand(DID_PAUSE_THREAD, this); + SendDbgCommand(DID_PAUSED_THREAD, this); } void CPUThread::Task() diff --git a/rpcs3/Emu/CPU/CPUThread.h b/rpcs3/Emu/CPU/CPUThread.h index b4e2a0784e..62a13d4a3c 100644 --- a/rpcs3/Emu/CPU/CPUThread.h +++ b/rpcs3/Emu/CPU/CPUThread.h @@ -133,7 +133,7 @@ public: u32 m_wait_thread_id; - wxCriticalSection m_cs_sync; + rCriticalSection m_cs_sync; bool m_sync_wait; void Wait(bool wait); void Wait(const CPUThread& thr); @@ -157,8 +157,8 @@ public: void SetError(const u32 error); - static wxArrayString ErrorToString(const u32 error); - wxArrayString ErrorToString() { return ErrorToString(m_error); } + static std::vector ErrorToString(const u32 error); + std::vector ErrorToString() { return ErrorToString(m_error); } bool IsOk() const { return m_error == 0; } bool IsRunning() const { return m_status == Running; } diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index f9a565ab19..353d44b7b9 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -43,9 +43,7 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type) new_thread->SetId(Emu.GetIdManager().GetNewID(fmt::Format("%s Thread", new_thread->GetTypeString().c_str()), new_thread)); m_threads.push_back(new_thread); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread); -#endif + SendDbgCommand(DID_CREATE_THREAD, new_thread); return *new_thread; } @@ -73,9 +71,7 @@ void CPUThreadManager::RemoveThread(const u32 id) if (thr) { -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr); -#endif + SendDbgCommand(DID_REMOVE_THREAD, thr); thr->Close(); m_threads.erase(m_threads.begin() + thread_index); diff --git a/rpcs3/Emu/CPU/CPUThreadManager.h b/rpcs3/Emu/CPU/CPUThreadManager.h index c0595dc693..f4b307a82a 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.h +++ b/rpcs3/Emu/CPU/CPUThreadManager.h @@ -6,7 +6,7 @@ class CPUThreadManager { std::vector m_threads; std::mutex m_mtx_thread; - wxSemaphore m_sem_task; + rSemaphore m_sem_task; u32 m_raw_spu_num; public: diff --git a/rpcs3/Emu/Cell/PPCDisAsm.h b/rpcs3/Emu/Cell/PPCDisAsm.h index 59086e8d94..39541d28ca 100644 --- a/rpcs3/Emu/Cell/PPCDisAsm.h +++ b/rpcs3/Emu/Cell/PPCDisAsm.h @@ -1,7 +1,6 @@ #pragma once #include "Emu/CPU/CPUDisAsm.h" -#include "Gui/DisAsmFrame.h" #include "Emu/Memory/Memory.h" class PPCDisAsm : public CPUDisAsm diff --git a/rpcs3/Emu/Cell/PPCThread.cpp b/rpcs3/Emu/Cell/PPCThread.cpp index 14c5a2a795..a813d10558 100644 --- a/rpcs3/Emu/Cell/PPCThread.cpp +++ b/rpcs3/Emu/Cell/PPCThread.cpp @@ -3,7 +3,6 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "PPCThread.h" -#include "Gui/InterpreterDisAsm.h" PPCThread* GetCurrentPPCThread() { diff --git a/rpcs3/Emu/Cell/PPUDisAsm.h b/rpcs3/Emu/Cell/PPUDisAsm.h index 102f30dd78..5fafd6b474 100644 --- a/rpcs3/Emu/Cell/PPUDisAsm.h +++ b/rpcs3/Emu/Cell/PPUDisAsm.h @@ -3,7 +3,6 @@ #include "Emu/Cell/PPUOpcodes.h" #include "Emu/Cell/PPCDisAsm.h" #include "Emu/Cell/PPCThread.h" -#include "Gui/DisAsmFrame.h" #include "Emu/Memory/Memory.h" class PPUDisAsm diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 6d319db432..f2d9e732c0 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -4,7 +4,7 @@ #include "Emu/Memory/Memory.h" #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SysCalls.h" -#include "rpcs3.h" +//#include "rpcs3.h" //GUI dependency #include #ifdef _MSC_VER #include @@ -2095,11 +2095,11 @@ private: case 0x1: UNK(fmt::Format("HyperCall %d", CPU.GPR[0])); break; case 0x2: SysCall(); break; case 0x3: - StaticExecute(CPU.GPR[11]); + Emu.GetSFuncManager().StaticExecute(CPU.GPR[11]); if (Ini.HLELogging.GetValue()) { ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx", - g_static_funcs_list[CPU.GPR[11]]->name, CPU.GPR[3], CPU.PC); + Emu.GetSFuncManager()[CPU.GPR[11]]->name, CPU.GPR[3], CPU.PC); } break; case 0x22: UNK("HyperCall LV1"); break; diff --git a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp index 247e85ad99..cc4da73fb1 100644 --- a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp +++ b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp @@ -1495,7 +1495,7 @@ void CompilePPUProgram::Compile() s_shstrtab.sh_size = section_name_offset; section_offset += s_shstrtab.sh_size; - wxFile f(fmt::FromUTF8(m_file_path), wxFile::write); + rFile f(m_file_path, rFile::write); elf_info.e_magic = 0x7F454C46; elf_info.e_class = 2; //ELF64 @@ -1585,7 +1585,7 @@ void CompilePPUProgram::Compile() } f.Seek(s_lib_stub_top.sh_offset); - f.Seek(s_lib_stub_top.sh_size, wxFromCurrent); + f.Seek(s_lib_stub_top.sh_size, rFromCurrent); f.Seek(s_lib_stub.sh_offset); for(u32 i=0, nameoffs=4, dataoffs=0; i enum diff --git a/rpcs3/Emu/Cell/SPUDisAsm.h b/rpcs3/Emu/Cell/SPUDisAsm.h index a480fec7d1..8df572bcf6 100644 --- a/rpcs3/Emu/Cell/SPUDisAsm.h +++ b/rpcs3/Emu/Cell/SPUDisAsm.h @@ -3,7 +3,6 @@ #include "Emu/Cell/SPUOpcodes.h" #include "Emu/Cell/PPCDisAsm.h" #include "Emu/Cell/SPUThread.h" -#include "Gui/DisAsmFrame.h" #include "Emu/Memory/Memory.h" class SPUDisAsm diff --git a/rpcs3/Emu/Cell/SPURecompilerCore.cpp b/rpcs3/Emu/Cell/SPURecompilerCore.cpp index bc0e222d32..5368e3b6d5 100644 --- a/rpcs3/Emu/Cell/SPURecompilerCore.cpp +++ b/rpcs3/Emu/Cell/SPURecompilerCore.cpp @@ -142,11 +142,11 @@ void SPURecompilerCore::Compile(u16 pos) entry[start].pointer = compiler.make(); compiler.setLogger(nullptr); // crashes without it - wxFile log; - log.Open(wxString::Format("SPUjit_%d.log", GetCurrentSPUThread().GetId()), first ? wxFile::write : wxFile::write_append); - log.Write(wxString::Format("========== START POSITION 0x%x ==========\n\n", start * 4)); - log.Write(wxString(stringLogger.getString())); - log.Write(wxString::Format("========== COMPILED %d (excess %d), time: [start=%lld (decoding=%lld), finalize=%lld]\n\n", + rFile log; + log.Open(fmt::Format("SPUjit_%d.log", GetCurrentSPUThread().GetId()), first ? rFile::write : rFile::write_append); + log.Write(fmt::Format("========== START POSITION 0x%x ==========\n\n", start * 4)); + log.Write(std::string(stringLogger.getString())); + log.Write(fmt::Format("========== COMPILED %d (excess %d), time: [start=%lld (decoding=%lld), finalize=%lld]\n\n", entry[start].count, excess, stamp1 - stamp0, time0, get_system_time() - stamp1)); log.Close(); m_enc->compiler = nullptr; diff --git a/rpcs3/Emu/ConLog.h b/rpcs3/Emu/ConLog.h index 3ec96fd81d..615d8e6d29 100644 --- a/rpcs3/Emu/ConLog.h +++ b/rpcs3/Emu/ConLog.h @@ -1,15 +1,8 @@ #pragma once -#include -#include "Ini.h" -#include "Gui/FrameBase.h" class LogWriter { - wxFile m_logfile; - wxColour m_txtcolour; - - //wxString m_prefix; - //wxString m_value; + rFile m_logfile; void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl); @@ -43,8 +36,9 @@ public: std::string frmt = fmt::Format(fmt, std::forward(args)...); WriteToLog("S", frmt, 1); } - - virtual void SkipLn(); + + virtual void SkipLn(); }; + extern LogWriter ConLog; diff --git a/rpcs3/Emu/DbgCommand.cpp b/rpcs3/Emu/DbgCommand.cpp new file mode 100644 index 0000000000..211195e1cf --- /dev/null +++ b/rpcs3/Emu/DbgCommand.cpp @@ -0,0 +1,6 @@ +#include "stdafx.h" + +void SendDbgCommand(DbgCommand id, CPUThread* thr ) +{ + wxGetApp().SendDbgCommand(id, thr); +} \ No newline at end of file diff --git a/rpcs3/Emu/DbgCommand.h b/rpcs3/Emu/DbgCommand.h new file mode 100644 index 0000000000..88daa6b821 --- /dev/null +++ b/rpcs3/Emu/DbgCommand.h @@ -0,0 +1,40 @@ +#pragma once + +class CPUThread; + +enum DbgCommand +{ + DID_FIRST_COMMAND = 0x500, + + DID_START_EMU, + DID_STARTED_EMU, + DID_STOP_EMU, + DID_STOPPED_EMU, + DID_PAUSE_EMU, + DID_PAUSED_EMU, + DID_RESUME_EMU, + DID_RESUMED_EMU, + DID_READY_EMU, + DID_CREATE_THREAD, + DID_CREATED_THREAD, + DID_REMOVE_THREAD, + DID_REMOVED_THREAD, + DID_RENAME_THREAD, + DID_RENAMED_THREAD, + DID_START_THREAD, + DID_STARTED_THREAD, + DID_STOP_THREAD, + DID_STOPED_THREAD, + DID_PAUSE_THREAD, + DID_PAUSED_THREAD, + DID_RESUME_THREAD, + DID_RESUMED_THREAD, + DID_EXEC_THREAD, + DID_REGISTRED_CALLBACK, + DID_UNREGISTRED_CALLBACK, + DID_EXIT_THR_SYSCALL, + + DID_LAST_COMMAND, +}; + +void SendDbgCommand(DbgCommand id, CPUThread* thr = nullptr); \ No newline at end of file diff --git a/rpcs3/Emu/DbgConsole.cpp b/rpcs3/Emu/DbgConsole.cpp index 712c3d0b77..11bab7990e 100644 --- a/rpcs3/Emu/DbgConsole.cpp +++ b/rpcs3/Emu/DbgConsole.cpp @@ -4,94 +4,91 @@ #include "Emu/System.h" #include "DbgConsole.h" -BEGIN_EVENT_TABLE(DbgConsole, FrameBase) - EVT_CLOSE(DbgConsole::OnQuit) -END_EVENT_TABLE() +LogWriter ConLog; +class LogFrame; +extern LogFrame* ConLogFrame; -DbgConsole::DbgConsole() - : FrameBase(nullptr, wxID_ANY, "Debug Console", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) - , ThreadBase("DbgConsole thread") - , m_output(nullptr) +_LogBuffer LogBuffer; + +std::mutex g_cs_conlog; + +const uint max_item_count = 500; +const uint buffer_size = 1024 * 64; + +static const std::string g_log_colors[] = { - m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, - wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); - m_console->SetBackgroundColour(wxColor("Black")); - m_console->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + "Black", "Green", "White", "Yellow", "Red", +}; - m_color_white = new wxTextAttr(wxColour(255, 255, 255)); - m_color_red = new wxTextAttr(wxColour(255, 0, 0)); - - if (Ini.HLESaveTTY.GetValue()) - m_output = new wxFile("tty.log", wxFile::write); -} - -DbgConsole::~DbgConsole() +LogWriter::LogWriter() { - ThreadBase::Stop(); - m_dbg_buffer.Flush(); - - safe_delete(m_console); - safe_delete(m_color_white); - safe_delete(m_color_red); - safe_delete(m_output); -} - -void DbgConsole::Write(int ch, const std::string& text) -{ - while (m_dbg_buffer.IsBusy()) + if (!m_logfile.Open(_PRGNAME_ ".log", rFile::write)) { - if (Emu.IsStopped()) - { - return; - } - Sleep(1); + rMessageBox("Can't create log file! (" _PRGNAME_ ".log)", rMessageBoxCaptionStr, rICON_ERROR); } - m_dbg_buffer.Push(DbgPacket(ch, text)); - - if(!IsAlive()) Start(); } -void DbgConsole::Clear() +void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/) { - m_console->Clear(); -} - -void DbgConsole::Task() -{ - while(!TestDestroy()) + std::string new_prefix = prefix; + if (!prefix.empty()) { - if(!m_dbg_buffer.HasNewPacket()) + if (NamedThreadBase* thr = GetCurrentNamedThread()) + { + new_prefix += " : " + thr->GetThreadName(); + } + } + + if (m_logfile.IsOpened() && !new_prefix.empty()) + m_logfile.Write("[" + new_prefix + "]: " + value + "\n"); + + if (!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) + return; + + std::lock_guard lock(g_cs_conlog); + + // TODO: Use ThreadBase instead, track main thread id + if (rThread::IsMain()) + { + while (LogBuffer.IsBusy()) + { + // need extra break condition? + rYieldIfNeeded(); + } + } + else + { + while (LogBuffer.IsBusy()) { if (Emu.IsStopped()) { break; } Sleep(1); - continue; } - - DbgPacket packet = m_dbg_buffer.Pop(); - m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white); - m_console->SetInsertionPointEnd(); - m_console->WriteText(fmt::FromUTF8(packet.m_text)); - - if (m_output && Ini.HLESaveTTY.GetValue()) - m_output->Write(fmt::FromUTF8(packet.m_text)); - - if(!DbgConsole::IsShown()) Show(); } + + //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); + + LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); } -void DbgConsole::OnQuit(wxCloseEvent& event) + +void LogWriter::SkipLn() +{ + WriteToLog("", "", 0); +} + +void DbgConsole::Close() +{ + i = 1; +} + +void DbgConsole::Clear() +{ + i = 2; +} + +void DbgConsole::Write(int ch, const std::string &msg) { - ThreadBase::Stop(false); - Hide(); - - if (m_output) - { - m_output->Close(); - m_output = nullptr; - } - - //event.Skip(); } diff --git a/rpcs3/Emu/DbgConsole.h b/rpcs3/Emu/DbgConsole.h index c4417b3880..ce17097552 100644 --- a/rpcs3/Emu/DbgConsole.h +++ b/rpcs3/Emu/DbgConsole.h @@ -1,5 +1,10 @@ #pragma once +#include //for memset + +extern const uint max_item_count; +extern const uint buffer_size; + struct DbgPacket { int m_ch; @@ -21,6 +26,87 @@ struct DbgPacket } }; +struct LogPacket +{ + const std::string m_prefix; + const std::string m_text; + const std::string m_colour; + + LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) + : m_prefix(prefix) + , m_text(text) + , m_colour(colour) + { + + } +}; + +struct _LogBuffer : public MTPacketBuffer +{ + _LogBuffer() : MTPacketBuffer(buffer_size) + { + } + + void _push(const LogPacket& data) + { + const u32 sprefix = data.m_prefix.length(); + const u32 stext = data.m_text.length(); + const u32 scolour = data.m_colour.length(); + + m_buffer.resize(m_buffer.size() + + sizeof(u32) + sprefix + + sizeof(u32) + stext + + sizeof(u32) + scolour); + + u32 c_put = m_put; + + memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); + c_put += sprefix; + + memcpy(&m_buffer[c_put], &stext, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); + c_put += stext; + + memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); + c_put += scolour; + + m_put = c_put; + CheckBusy(); + } + + LogPacket _pop() + { + u32 c_get = m_get; + + const u32& sprefix = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string prefix((const char*)&m_buffer[c_get], sprefix); + c_get += sprefix; + + const u32& stext = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string text((const char*)&m_buffer[c_get], stext); + c_get += stext; + + const u32& scolour = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string colour((const char*)&m_buffer[c_get], scolour); + c_get += scolour; + + m_get = c_get; + if (!HasNewPacket()) Flush(); + + return LogPacket(prefix, text, colour); + } +}; + +extern _LogBuffer LogBuffer; + struct _DbgBuffer : public MTPacketBuffer { _DbgBuffer() : MTPacketBuffer(1024) @@ -68,24 +154,10 @@ struct _DbgBuffer : public MTPacketBuffer } }; -class DbgConsole - : public FrameBase - , public ThreadBase +struct DbgConsole { - wxFile* m_output; - wxTextCtrl* m_console; - wxTextAttr* m_color_white; - wxTextAttr* m_color_red; - _DbgBuffer m_dbg_buffer; - -public: - DbgConsole(); - ~DbgConsole(); - void Write(int ch, const std::string& text); + int i; + void Close(); void Clear(); - virtual void Task(); - -private: - void OnQuit(wxCloseEvent& event); - DECLARE_EVENT_TABLE(); -}; + void Write(int ch, const std::string &msg); +}; \ No newline at end of file diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index ac59b8636e..3a55fc68c1 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -243,9 +243,9 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path) u32 max_eq; s32 max_i=-1; - wxFileName file_path(fmt::FromUTF8(local_path)); + rFileName file_path(local_path); file_path.Normalize(); - std::string mormalized_path = fmt::ToUTF8(file_path.GetFullPath()); + std::string mormalized_path = file_path.GetFullPath(); for(u32 i=0; i arr0 = fmt::rSplit(path0.GetFullPath(), DL); + std::vector arr1 = fmt::rSplit(local_path, DL); - const u32 lim = std::min(arr0.GetCount(), arr1.GetCount()); + const u32 lim = std::min(arr0.size(), arr1.size()); u32 ret = 0; - for(u32 i=0; i& vfsDirBase::GetEntries() const diff --git a/rpcs3/Emu/FS/vfsLocalDir.cpp b/rpcs3/Emu/FS/vfsLocalDir.cpp index 285e3df15e..349923e749 100644 --- a/rpcs3/Emu/FS/vfsLocalDir.cpp +++ b/rpcs3/Emu/FS/vfsLocalDir.cpp @@ -15,24 +15,24 @@ bool vfsLocalDir::Open(const std::string& path) if(!vfsDirBase::Open(path)) return false; - wxDir dir; + rDir dir; if(!dir.Open(path)) return false; - wxString name; + std::string name; for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name)) { - wxString dir_path = fmt::FromUTF8(path) + name; + std::string dir_path = path + name; m_entries.emplace_back(); DirEntryInfo& info = m_entries.back(); - info.name = fmt::ToUTF8(name); + info.name = name; info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile; - if(wxIsWritable(dir_path)) info.flags |= DirEntry_PermWritable; - if(wxIsReadable(dir_path)) info.flags |= DirEntry_PermReadable; - if(wxIsExecutable(dir_path)) info.flags |= DirEntry_PermExecutable; + if(rIsWritable(dir_path)) info.flags |= DirEntry_PermWritable; + if(rIsReadable(dir_path)) info.flags |= DirEntry_PermReadable; + if(rIsExecutable(dir_path)) info.flags |= DirEntry_PermExecutable; } return true; @@ -40,7 +40,7 @@ bool vfsLocalDir::Open(const std::string& path) bool vfsLocalDir::Create(const std::string& path) { - return wxFileName::Mkdir(fmt::FromUTF8(path), 0777, wxPATH_MKDIR_FULL); + return rFileName::Mkdir(path, 0777, rPATH_MKDIR_FULL); } bool vfsLocalDir::Rename(const std::string& from, const std::string& to) @@ -50,5 +50,5 @@ bool vfsLocalDir::Rename(const std::string& from, const std::string& to) bool vfsLocalDir::Remove(const std::string& path) { - return wxRmdir(fmt::FromUTF8(path)); + return rRmdir(path); } diff --git a/rpcs3/Emu/FS/vfsLocalFile.cpp b/rpcs3/Emu/FS/vfsLocalFile.cpp index dd4b145ae2..46e989354f 100644 --- a/rpcs3/Emu/FS/vfsLocalFile.cpp +++ b/rpcs3/Emu/FS/vfsLocalFile.cpp @@ -2,30 +2,30 @@ #include "Emu/ConLog.h" #include "vfsLocalFile.h" -static const wxFile::OpenMode vfs2wx_mode(vfsOpenMode mode) +static const rFile::OpenMode vfs2wx_mode(vfsOpenMode mode) { switch(mode) { - case vfsRead: return wxFile::read; - case vfsWrite: return wxFile::write; - case vfsReadWrite: return wxFile::read_write; - case vfsWriteExcl: return wxFile::write_excl; - case vfsWriteAppend: return wxFile::write_append; + case vfsRead: return rFile::read; + case vfsWrite: return rFile::write; + case vfsReadWrite: return rFile::read_write; + case vfsWriteExcl: return rFile::write_excl; + case vfsWriteAppend: return rFile::write_append; } - return wxFile::read; + return rFile::read; } -static const wxSeekMode vfs2wx_seek(vfsSeekMode mode) +static const rSeekMode vfs2wx_seek(vfsSeekMode mode) { switch(mode) { - case vfsSeekSet: return wxFromStart; - case vfsSeekCur: return wxFromCurrent; - case vfsSeekEnd: return wxFromEnd; + case vfsSeekSet: return rFromStart; + case vfsSeekCur: return rFromCurrent; + case vfsSeekEnd: return rFromEnd; } - return wxFromStart; + return rFromStart; } vfsLocalFile::vfsLocalFile(vfsDevice* device) : vfsFileBase(device) @@ -45,9 +45,9 @@ bool vfsLocalFile::Open(const std::string& path, vfsOpenMode mode) // } // else // { - if(!m_file.Access(fmt::FromUTF8(path), vfs2wx_mode(mode))) return false; + if(!m_file.Access(path, vfs2wx_mode(mode))) return false; - return m_file.Open(fmt::FromUTF8(path), vfs2wx_mode(mode)) && vfsFileBase::Open(path, mode); + return m_file.Open(path, vfs2wx_mode(mode)) && vfsFileBase::Open(path, mode); // } } @@ -63,19 +63,19 @@ bool vfsLocalFile::Create(const std::string& path) break; const std::string& dir = path.substr(0, p); - if(!wxDirExists(fmt::FromUTF8(dir))) + if(!rDirExists(dir)) { ConLog.Write("create dir: %s", dir.c_str()); - wxMkdir(fmt::FromUTF8(dir)); + rMkdir(dir); } } //create file const char m = path[path.length() - 1]; - if(m != '/' && m != '\\' && !wxFileExists(fmt::FromUTF8(path))) // ??? + if(m != '/' && m != '\\' && !rFileExists(path)) // ??? { - wxFile f; - return f.Create(fmt::FromUTF8(path)); + rFile f; + return f.Create(path); } return true; diff --git a/rpcs3/Emu/FS/vfsLocalFile.h b/rpcs3/Emu/FS/vfsLocalFile.h index ec0c12d72a..a7aac7b1ea 100644 --- a/rpcs3/Emu/FS/vfsLocalFile.h +++ b/rpcs3/Emu/FS/vfsLocalFile.h @@ -4,7 +4,7 @@ class vfsLocalFile : public vfsFileBase { private: - wxFile m_file; + rFile m_file; public: vfsLocalFile(vfsDevice* device); diff --git a/rpcs3/Emu/GS/GCM.h b/rpcs3/Emu/GS/GCM.h index 6f19cdb6c9..74c88c7a04 100644 --- a/rpcs3/Emu/GS/GCM.h +++ b/rpcs3/Emu/GS/GCM.h @@ -1269,7 +1269,7 @@ static const std::string GetMethodName(const u32 id) { NV4097_SET_TRANSFORM_BRANCH_BITS, "SetTransformBranchBits" } , }; - for(u32 i = 0; i < WXSIZEOF(METHOD_NAME_LIST); ++i) + for (u32 i = 0; i < SARRSIZEOF(METHOD_NAME_LIST); ++i) { if(METHOD_NAME_LIST[i].id == id) return "cellGcm" + METHOD_NAME_LIST[i].name; } diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index f5dda76c88..7fdcd7e19c 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -4,7 +4,6 @@ #include "Emu/System.h" #include "GLGSRender.h" #include "Emu/Cell/PPCInstrTable.h" -#include "Gui/RSXDebugger.h" #define CMD_DEBUG 0 #define DUMP_VERTEX_DATA 0 @@ -39,53 +38,6 @@ void printGlError(GLenum err, const std::string& situation) #define checkForGlError(x) /*x*/ #endif -GLGSFrame::GLGSFrame() - : GSFrame(nullptr, "GSFrame[OpenGL]") - , m_frames(0) -{ - canvas = new wxGLCanvas(this, wxID_ANY, NULL); - canvas->SetSize(GetClientSize()); - - canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this); -} - -void GLGSFrame::Flip(wxGLContext *context) -{ - if(!canvas) return; - canvas->SetCurrent(*context); - - static Timer fps_t; - canvas->SwapBuffers(); - m_frames++; - - if(fps_t.GetElapsedTimeInSec() >= 0.5) - { - SetTitle(wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec())); - m_frames = 0; - fps_t.Start(); - } -} - -void GLGSFrame::OnSize(wxSizeEvent& event) -{ - if(canvas) canvas->SetSize(GetClientSize()); - event.Skip(); -} - -void GLGSFrame::SetViewport(int x, int y, u32 w, u32 h) -{ - /* - //ConLog.Warning("SetViewport(x=%d, y=%d, w=%d, h=%d)", x, y, w, h); - - const wxSize client = GetClientSize(); - const wxSize viewport = AspectRatio(client, wxSize(w, h)); - - const int vx = (client.GetX() - viewport.GetX()) / 2; - const int vy = (client.GetY() - viewport.GetY()) / 2; - - glViewport(vx + x, vy + y, viewport.GetWidth(), viewport.GetHeight()); - */ -} GLGSRender::GLGSRender() : GSRender() @@ -94,7 +46,7 @@ GLGSRender::GLGSRender() , m_vp_buf_num(-1) , m_context(nullptr) { - m_frame = new GLGSFrame(); + m_frame = new rGLFrame();// new GLGSFrame(); } GLGSRender::~GLGSRender() @@ -164,7 +116,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw) checkForGlError("initializing vbo"); #if DUMP_VERTEX_DATA - wxFile dump("VertexDataArray.dump", wxFile::write); + rFile dump("VertexDataArray.dump", rFile::write); #endif for(u32 i=0; iGetCanvas()); + m_context = m_frame->GetNewContext();//new rGLContext(m_frame->GetCanvas()); + + //m_frame->GetCanvas()->SetCurrent(*m_context); + m_frame->SetCurrent(m_context); - m_frame->GetCanvas()->SetCurrent(*m_context); InitProcTable(); glEnable(GL_TEXTURE_2D); diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index b0d7ca74a8..2512062d1b 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -3,7 +3,6 @@ #include "Emu/GS/RSXThread.h" #include "GLBuffers.h" #include "GLProgramBuffer.h" -#include #pragma comment(lib, "opengl32.lib") @@ -501,7 +500,7 @@ public: } } - void Save(RSXTexture& tex, const wxString& name) + void Save(RSXTexture& tex, const std::string& name) { if(!m_id || !tex.GetOffset() || !tex.GetWidth() || !tex.GetHeight()) return; @@ -527,7 +526,7 @@ public: } { - wxFile f(name + ".raw", wxFile::write); + rFile f(name + ".raw", rFile::write); f.Write(alldata, texPixelCount * 4); } u8* data = new u8[texPixelCount * 3]; @@ -544,9 +543,9 @@ public: *dst_a++ = *src++; } - wxImage out; + rImage out; out.Create(tex.GetWidth(), tex.GetHeight(), data, alpha); - out.SaveFile(name, wxBITMAP_TYPE_PNG); + out.SaveFile(name, rBITMAP_TYPE_PNG); delete[] alldata; //free(data); @@ -555,14 +554,14 @@ public: void Save(RSXTexture& tex) { - static const wxString& dir_path = "textures"; - static const wxString& file_fmt = dir_path + "/" + "tex[%d].png"; + static const std::string& dir_path = "textures"; + static const std::string& file_fmt = dir_path + "/" + "tex[%d].png"; - if(!wxDirExists(dir_path)) wxMkdir(dir_path); + if(!rDirExists(dir_path)) rMkdir(dir_path); u32 count = 0; - while(wxFileExists(wxString::Format(file_fmt, count))) count++; - Save(tex, wxString::Format(file_fmt, count)); + while(rFileExists(fmt::Format(file_fmt, count))) count++; + Save(tex, fmt::Format(file_fmt, count)); } void Bind() @@ -585,24 +584,6 @@ public: } }; -struct GLGSFrame : public GSFrame -{ - wxGLCanvas* canvas; - u32 m_frames; - - GLGSFrame(); - ~GLGSFrame() {} - - void Flip(wxGLContext *context); - - wxGLCanvas* GetCanvas() const { return canvas; } - - virtual void SetViewport(int x, int y, u32 w, u32 h); - -private: - virtual void OnSize(wxSizeEvent& event); -}; - class PostDrawObj { protected: @@ -787,9 +768,9 @@ public: } }; -class GLGSRender - : public wxWindow - , public GSRender +class GLGSRender //TODO: find out why this used to inherit from wxWindow + : //public wxWindow + /*,*/ public GSRender { private: std::vector m_vdata; @@ -810,10 +791,10 @@ private: GLrbo m_rbo; GLfbo m_fbo; - wxGLContext* m_context; + void* m_context; public: - GLGSFrame* m_frame; + rGLFrame* m_frame; u32 m_draw_frames; u32 m_skip_frames; diff --git a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp index f77cd244a5..ac1205e403 100644 --- a/rpcs3/Emu/GS/GL/GLVertexProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLVertexProgram.cpp @@ -77,7 +77,7 @@ std::string GLVertexDecompilerThread::GetSRC(const u32 n) ret += m_parr.AddParam(PARAM_NONE, "vec4", "tmp" + std::to_string(src[n].tmp_src)); break; case 2: //input - if(d1.input_src < WXSIZEOF(reg_table)) + if (d1.input_src < SARRSIZEOF(reg_table)) { ret += m_parr.AddParam(PARAM_IN, "vec4", reg_table[d1.input_src], d1.input_src); } diff --git a/rpcs3/Emu/GS/GSManager.cpp b/rpcs3/Emu/GS/GSManager.cpp index 16ca4d3bc5..7774f04978 100644 --- a/rpcs3/Emu/GS/GSManager.cpp +++ b/rpcs3/Emu/GS/GSManager.cpp @@ -7,11 +7,6 @@ #include "Null/NullGSRender.h" #include "GL/GLGSRender.h" -BEGIN_EVENT_TABLE(GSFrame, wxFrame) - EVT_PAINT(GSFrame::OnPaint) - EVT_SIZE(GSFrame::OnSize) -END_EVENT_TABLE() - GSManager::GSManager() : m_render(nullptr) { } diff --git a/rpcs3/Emu/GS/GSRender.cpp b/rpcs3/Emu/GS/GSRender.cpp index 255236497f..742aed85d0 100644 --- a/rpcs3/Emu/GS/GSRender.cpp +++ b/rpcs3/Emu/GS/GSRender.cpp @@ -2,85 +2,9 @@ #include "Emu/ConLog.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -#include "rpcs3/rpcs3.h" #include "GSRender.h" -wxSize AspectRatio(wxSize rs, const wxSize as) -{ - const double aq = (double)as.x / as.y; - const double rq = (double)rs.x / rs.y; - const double q = aq / rq; - - if(q > 1.0) - { - rs.y /= q; - } - else if(q < 1.0) - { - rs.x *= q; - } - - return rs; -} - -GSFrame::GSFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title) -{ - CellVideoOutResolution res = ResolutionTable[ResolutionIdToNum(Ini.GSResolution.GetValue())]; - SetClientSize(res.width, res.height); - wxGetApp().Bind(wxEVT_KEY_DOWN, &GSFrame::OnKeyDown, this); - Bind(wxEVT_CLOSE_WINDOW, &GSFrame::OnClose, this); -} - -void GSFrame::OnPaint(wxPaintEvent& event) -{ - wxPaintDC(this); -} - -void GSFrame::OnClose(wxCloseEvent& event) -{ - Emu.Stop(); -} - -/* -void GSFrame::OnSize(wxSizeEvent&) -{ - const wxSize client = GetClientSize(); - const wxSize viewport = AspectRatio(client, m_size); - - const int x = (client.GetX() - viewport.GetX()) / 2; - const int y = (client.GetY() - viewport.GetY()) / 2; - - SetViewport(wxPoint(x, y), viewport); -} -*/ - -void GSFrame::OnKeyDown(wxKeyEvent& event) -{ - switch(event.GetKeyCode()) - { - case WXK_RETURN: if(event.AltDown()) { OnFullScreen(); return; } break; - case WXK_ESCAPE: if(IsFullScreen()) { ShowFullScreen(false); return; } break; - } - event.Skip(); -} - -void GSFrame::OnFullScreen() -{ - ShowFullScreen(!IsFullScreen()); -} - - -/* -void GSFrame::SetSize(int width, int height) -{ - m_size.SetWidth(width); - m_size.SetHeight(height); - //wxFrame::SetSize(width, height); - OnSize(wxSizeEvent()); -} -*/ - GSLockCurrent::GSLockCurrent(GSLockType type) : GSLock(Emu.GetGSManager().GetRender(), type) { } diff --git a/rpcs3/Emu/GS/GSRender.h b/rpcs3/Emu/GS/GSRender.h index 3ae017cb39..5f55543327 100644 --- a/rpcs3/Emu/GS/GSRender.h +++ b/rpcs3/Emu/GS/GSRender.h @@ -2,34 +2,6 @@ #include "Emu/GS/GCM.h" #include "Emu/GS/RSXThread.h" -wxSize AspectRatio(wxSize rs, const wxSize as); - -class GSFrame : public wxFrame -{ -protected: - GSFrame(wxWindow* parent, const wxString& title); - - virtual void SetViewport(int x, int y, u32 w, u32 h) {} - virtual void OnPaint(wxPaintEvent& event); - virtual void OnClose(wxCloseEvent& event); - - //virtual void OnSize(wxSizeEvent&); - - void OnKeyDown(wxKeyEvent& event); - void OnFullScreen(); - -public: - void OnLeftDclick(wxMouseEvent&) - { - OnFullScreen(); - } - - //void SetSize(int width, int height); - -private: - DECLARE_EVENT_TABLE(); -}; - struct GSRender : public RSXThread { virtual ~GSRender() diff --git a/rpcs3/Emu/GS/Null/NullGSRender.h b/rpcs3/Emu/GS/Null/NullGSRender.h index aaba2ec398..b337045b48 100644 --- a/rpcs3/Emu/GS/Null/NullGSRender.h +++ b/rpcs3/Emu/GS/Null/NullGSRender.h @@ -1,58 +1,22 @@ #pragma once #include "Emu/GS/GSRender.h" -struct NullGSFrame : public GSFrame -{ - NullGSFrame() : GSFrame(nullptr, "GSFrame[Null]") - { - Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this); - } - - void Draw() - { - wxClientDC dc(this); - Draw(&dc); - } - -private: - virtual void OnPaint(wxPaintEvent& event) - { - wxPaintDC dc(this); - Draw(&dc); - } - virtual void OnSize(wxSizeEvent& event) - { - GSFrame::OnSize(event); - Draw(); - } - - void Draw(wxDC* dc) - { - dc->DrawText("Null GS output", 0, 0); - } -}; - class NullGSRender - : public wxWindow - , public GSRender + : public GSRender { public: - NullGSFrame* m_frame; - NullGSRender() : m_frame(nullptr) + NullGSRender() { - m_frame = new NullGSFrame(); } virtual ~NullGSRender() { - m_frame->Close(); } private: virtual void OnInit() { - m_frame->Show(); } virtual void OnInitThread() @@ -77,8 +41,5 @@ private: virtual void Close() { - Stop(); - - if(m_frame->IsShown()) m_frame->Hide(); } }; diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index b22e60c47f..bbc6555344 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -1833,7 +1833,7 @@ void RSXThread::Task() while(!TestDestroy()) { - wxCriticalSectionLocker lock(m_cs_main); + rCriticalSectionLocker lock(m_cs_main); inc=1; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index e492ea8708..7e1a3e8f22 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -142,9 +142,9 @@ public: u32 m_draw_array_first; public: - wxCriticalSection m_cs_main; - wxSemaphore m_sem_flush; - wxSemaphore m_sem_flip; + rCriticalSection m_cs_main; + rSemaphore m_sem_flush; + rSemaphore m_sem_flip; Callback m_flip_handler; public: diff --git a/rpcs3/Emu/HDD/HDD.h b/rpcs3/Emu/HDD/HDD.h index f00cf41301..4adfd684fc 100644 --- a/rpcs3/Emu/HDD/HDD.h +++ b/rpcs3/Emu/HDD/HDD.h @@ -63,7 +63,7 @@ public: static void CreateHDD(const std::string& path, u64 size, u64 block_size) { - wxFile f(fmt::FromUTF8(path), wxFile::write); + rFile f(path, rFile::write); static const u64 cur_dir_block = 1; diff --git a/rpcs3/Emu/Io/Keyboard.cpp b/rpcs3/Emu/Io/Keyboard.cpp index 7181459973..fa8df62eb3 100644 --- a/rpcs3/Emu/Io/Keyboard.cpp +++ b/rpcs3/Emu/Io/Keyboard.cpp @@ -1,10 +1,8 @@ #include "stdafx.h" #include "Emu/ConLog.h" #include "rpcs3/Ini.h" -#include "rpcs3.h" #include "Keyboard.h" #include "Null/NullKeyboardHandler.h" -#include "Windows/WindowsKeyboardHandler.h" KeyboardManager::KeyboardManager() : m_keyboard_handler(nullptr) @@ -22,17 +20,13 @@ void KeyboardManager::Init(const u32 max_connect) return; // NOTE: Change these to std::make_unique assignments when C++14 comes out. - switch(Ini.KeyboardHandlerMode.GetValue()) + int numHandlers = rPlatform::getKeyboardHandlerCount(); + int selectedHandler = Ini.KeyboardHandlerMode.GetValue(); + if (selectedHandler > numHandlers) { - case 1: - m_keyboard_handler.reset(new WindowsKeyboardHandler()); - break; - - default: - case 0: - m_keyboard_handler.reset(new NullKeyboardHandler()); - break; + selectedHandler = 0; } + m_keyboard_handler.reset(rPlatform::getKeyboardHandler(selectedHandler)); m_keyboard_handler->Init(max_connect); m_inited = true; diff --git a/rpcs3/Emu/Io/Mouse.cpp b/rpcs3/Emu/Io/Mouse.cpp index 2a75bb3846..8e96c65e95 100644 --- a/rpcs3/Emu/Io/Mouse.cpp +++ b/rpcs3/Emu/Io/Mouse.cpp @@ -1,10 +1,8 @@ #include "stdafx.h" #include "Emu/ConLog.h" #include "rpcs3/Ini.h" -#include "rpcs3.h" #include "Mouse.h" #include "Null/NullMouseHandler.h" -#include "Windows/WindowsMouseHandler.h" MouseManager::MouseManager() : m_mouse_handler(nullptr) @@ -22,17 +20,13 @@ void MouseManager::Init(const u32 max_connect) return; // NOTE: Change these to std::make_unique assignments when C++14 is available. - switch(Ini.MouseHandlerMode.GetValue()) + int numHandlers = rPlatform::getMouseHandlerCount(); + int selectedHandler = Ini.MouseHandlerMode.GetValue(); + if (selectedHandler > numHandlers) { - case 1: - m_mouse_handler.reset(new WindowsMouseHandler()); - break; - - default: - case 0: - m_mouse_handler.reset(new NullMouseHandler()); - break; + selectedHandler = 0; } + m_mouse_handler.reset(rPlatform::getMouseHandler(selectedHandler)); m_mouse_handler->Init(max_connect); m_inited = true; diff --git a/rpcs3/Emu/Io/Null/NullKeyboardHandler.h b/rpcs3/Emu/Io/Null/NullKeyboardHandler.h index 78d25be2b3..d4c187f489 100644 --- a/rpcs3/Emu/Io/Null/NullKeyboardHandler.h +++ b/rpcs3/Emu/Io/Null/NullKeyboardHandler.h @@ -1,6 +1,7 @@ #pragma once #include "Emu/Io/KeyboardHandler.h" +#include //for memset class NullKeyboardHandler final : public KeyboardHandlerBase { diff --git a/rpcs3/Emu/Io/Null/NullMouseHandler.h b/rpcs3/Emu/Io/Null/NullMouseHandler.h index 883bca01ef..4141190d82 100644 --- a/rpcs3/Emu/Io/Null/NullMouseHandler.h +++ b/rpcs3/Emu/Io/Null/NullMouseHandler.h @@ -1,6 +1,7 @@ #pragma once #include "Emu/Io/MouseHandler.h" +#include //for memset class NullMouseHandler final : public MouseHandlerBase { diff --git a/rpcs3/Emu/Io/Null/NullPadHandler.h b/rpcs3/Emu/Io/Null/NullPadHandler.h index d770bf4a00..5add5ae3c7 100644 --- a/rpcs3/Emu/Io/Null/NullPadHandler.h +++ b/rpcs3/Emu/Io/Null/NullPadHandler.h @@ -1,6 +1,7 @@ #pragma once #include "Emu/Io/PadHandler.h" +#include //for memset class NullPadHandler final : public PadHandlerBase { diff --git a/rpcs3/Emu/Io/Pad.cpp b/rpcs3/Emu/Io/Pad.cpp index 486fd37ef4..41d4b7ca43 100644 --- a/rpcs3/Emu/Io/Pad.cpp +++ b/rpcs3/Emu/Io/Pad.cpp @@ -1,13 +1,16 @@ #include "stdafx.h" #include "Emu/ConLog.h" #include "rpcs3/Ini.h" -#include "rpcs3.h" #include "Pad.h" #include "Null/NullPadHandler.h" +#ifdef wxGUI #include "Windows/WindowsPadHandler.h" +#include "rpcs3.h" #if defined(_WIN32) #include "XInput/XInputPadHandler.h" #endif +#endif + PadManager::PadManager() : m_pad_handler(nullptr) @@ -25,23 +28,13 @@ void PadManager::Init(const u32 max_connect) return; // NOTE: Change these to std::make_unique assignments when C++14 is available. - switch(Ini.PadHandlerMode.GetValue()) + int numHandlers = rPlatform::getPadHandlerCount(); + int selectedHandler = Ini.PadHandlerMode.GetValue(); + if (selectedHandler > numHandlers) { - case 1: - m_pad_handler.reset(new WindowsPadHandler()); - break; - -#if defined(_WIN32) - case 2: - m_pad_handler.reset(new XInputPadHandler()); - break; -#endif - - default: - case 0: - m_pad_handler.reset(new NullPadHandler()); - break; + selectedHandler = 0; } + m_pad_handler.reset(rPlatform::getPadHandler(selectedHandler)); m_pad_handler->Init(max_connect); m_inited = true; diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index 7742a02027..d4821b4b25 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -1136,10 +1136,3 @@ typedef mem_list_ptr_t mem16_ptr_t; typedef mem_list_ptr_t mem32_ptr_t; typedef mem_list_ptr_t mem64_ptr_t; -//#define re(val) MemoryBase::Reverse(val) -#define re64(val) MemoryBase::Reverse64(val) -#define re32(val) MemoryBase::Reverse32(val) -#define re16(val) MemoryBase::Reverse16(val) - -template T re(const T val) { T res; se_t::func(res, val); return res; } -template void re(T1& dst, const T2 val) { se_t::func(dst, val); } diff --git a/rpcs3/Emu/SysCalls/ModuleManager.cpp b/rpcs3/Emu/SysCalls/ModuleManager.cpp new file mode 100644 index 0000000000..fa03dd18cb --- /dev/null +++ b/rpcs3/Emu/SysCalls/ModuleManager.cpp @@ -0,0 +1,450 @@ +#include "stdafx.h" +#include "ModuleManager.h" + +extern void cellAdec_init(); +extern Module* cellAdec; +extern void cellAtrac_init(); +extern Module *cellAtrac; +extern void cellAudio_init(); +extern Module *cellAudio; +extern void cellDmux_init(); +extern Module *cellDmux; +extern void cellFont_init(); +extern void cellFont_load(); +extern void cellFont_unload(); +extern Module *cellFont; +extern void sys_net_init(); +extern Module *sys_net; +extern void sceNpTrophy_unload(); +extern void sceNpTrophy_init(); +extern Module *sceNpTrophy; +extern void sceNp_init(); +extern Module *sceNp; +extern void cellUserInfo_init(); +extern Module *cellUserInfo; +extern void cellSysutil_init(); +extern Module *cellSysutil; +extern void cellSysutilAp_init(); +extern Module *cellSysutilAp; +extern void cellPngDec_init(); +extern Module *cellPngDec; +extern void cellNetCtl_init(); +extern Module *cellNetCtl; +extern void cellJpgDec_init(); +extern Module *cellJpgDec; +extern void cellFontFT_init(); +extern void cellFontFT_load(); +extern void cellFontFT_unload(); +extern Module *cellFontFT; +extern void cellGifDec_init(); +extern Module *cellGifDec; +extern void cellGcmSys_init(); +extern void cellGcmSys_load(); +extern void cellGcmSys_unload(); +extern Module *cellGcmSys; +extern void cellGame_init(); +extern Module *cellGame; +extern void sys_io_init(); +extern Module *sys_io; +extern void cellL10n_init(); +extern Module *cellL10n; +extern void cellPamf_init(); +extern Module *cellPamf; +extern void cellResc_init(); +extern void cellResc_load(); +extern void cellResc_unload(); +extern Module *cellResc; +extern void cellRtc_init(); +extern Module *cellRtc; +extern void cellSpurs_init(); +extern Module *cellSpurs; +extern void cellSync_init(); +extern Module *cellSync; +extern void cellSysmodule_init(); +extern Module *cellSysmodule; +extern void cellVdec_init(); +extern Module *cellVdec; +extern void cellVpost_init(); +extern Module *cellVpost; +extern void libmixer_init(); +extern Module *libmixer; +extern void sysPrxForUser_init(); +extern Module *sysPrxForUser; +extern void sys_fs_init(); +extern Module *sys_fs; + +struct ModuleInfo +{ + u32 id; + const char* name; +} +static const g_module_list[] = +{ + { 0x0000, "sys_net" }, + { 0x0001, "sys_http" }, + { 0x0002, "cellHttpUtil" }, + { 0x0003, "cellSsl" }, + { 0x0004, "cellHttps" }, + { 0x0005, "libvdec" }, + { 0x0006, "cellAdec" }, + { 0x0007, "cellDmux" }, + { 0x0008, "cellVpost" }, + { 0x0009, "cellRtc" }, + { 0x000a, "cellSpurs" }, + { 0x000b, "cellOvis" }, + { 0x000c, "cellSheap" }, + { 0x000d, "sys_sync" }, + { 0x000e, "sys_fs" }, + { 0x000f, "cellJpgDec" }, + { 0x0010, "cellGcmSys" }, + { 0x0011, "cellAudio" }, + { 0x0012, "cellPamf" }, + { 0x0013, "cellAtrac" }, + { 0x0014, "cellNetCtl" }, + { 0x0015, "cellSysutil" }, + { 0x0016, "sceNp" }, + { 0x0017, "sys_io" }, + { 0x0018, "cellPngDec" }, + { 0x0019, "cellFont" }, + { 0x001a, "cellFontFT" }, + { 0x001b, "cellFreetype" }, + { 0x001c, "cellUsbd" }, + { 0x001d, "cellSail" }, + { 0x001e, "cellL10n" }, + { 0x001f, "cellResc" }, + { 0x0020, "cellDaisy" }, + { 0x0021, "cellKey2char" }, + { 0x0022, "cellMic" }, + { 0x0023, "cellCamera" }, + { 0x0024, "cellVdecMpeg2" }, + { 0x0025, "cellVdecAvc" }, + { 0x0026, "cellAdecLpcm" }, + { 0x0027, "cellAdecAc3" }, + { 0x0028, "cellAdecAtx" }, + { 0x0029, "cellAdecAt3" }, + { 0x002a, "cellDmuxPamf" }, + { 0x002e, "cellLv2dbg" }, + { 0x0030, "cellUsbpspcm" }, + { 0x0031, "cellAvconfExt" }, + { 0x0032, "cellUserInfo" }, + { 0x0033, "cellSysutilSavedata" }, + { 0x0034, "cellSubdisplay" }, + { 0x0035, "cellSysutilRec" }, + { 0x0036, "cellVideoExport" }, + { 0x0037, "cellGameExec" }, + { 0x0038, "sceNp2" }, + { 0x0039, "cellSysutilAp" }, + { 0x003a, "cellSysutilNpClans" }, + { 0x003b, "cellSysutilOskExt" }, + { 0x003c, "cellVdecDivx" }, + { 0x003d, "cellJpgEnc" }, + { 0x003e, "cellGame" }, + { 0x003f, "cellBgdl" }, + { 0x0040, "cellFreetypeTT" }, + { 0x0041, "cellSysutilVideoUpload" }, + { 0x0042, "cellSysutilSysconfExt" }, + { 0x0043, "cellFiber" }, + { 0x0044, "cellNpCommerce2" }, + { 0x0045, "cellNpTus" }, + { 0x0046, "cellVoice" }, + { 0x0047, "cellAdecCelp8" }, + { 0x0048, "cellCelp8Enc" }, + { 0x0049, "cellLicenseArea" }, + { 0x004a, "cellMusic2" }, + { 0x004e, "cellScreenshot" }, + { 0x004f, "cellMusicDecode" }, + { 0x0050, "cellSpursJq" }, + { 0x0052, "cellPngEnc" }, + { 0x0053, "cellMusicDecode2" }, + { 0x0055, "cellSync2" }, + { 0x0056, "cellNpUtil" }, + { 0x0057, "cellRudp" }, + { 0x0059, "cellNpSns" }, + { 0x005a, "cellGem" }, + { 0xf00a, "cellCelpEnc" }, + { 0xf010, "cellGifDec" }, + { 0xf019, "cellAdecCelp" }, + { 0xf01b, "cellAdecM2bc" }, + { 0xf01d, "cellAdecM4aac" }, + { 0xf01e, "cellAdecMp3" }, + { 0xf023, "cellImejp" }, + { 0xf028, "cellMusic" }, + { 0xf029, "cellPhotoExport" }, + { 0xf02a, "cellPrint" }, + { 0xf02b, "cellPhotoImport" }, + { 0xf02c, "cellMusicExport" }, + { 0xf02e, "cellPhotoDecode" }, + { 0xf02f, "cellSearch" }, + { 0xf030, "cellAvchat2" }, + { 0xf034, "cellSailRec" }, + { 0xf035, "sceNpTrophy" }, + { 0xf053, "cellAdecAt3multi" }, + { 0xf054, "cellLibatrac3multi" } +}; + +void ModuleManager::init() +{ + //this is a really bad hack and the whole idea of Modules and how they're implemented should probably be changed + //the contruction of the modules accessses the global variable for that module. + //For example cellAdec needs to be set before cellAdec_init is called but it would be called in the constructor of + //cellAdec, so we need to point cellAdec to where we will construct it in the future + if (!initialized) + { + m_mod_init.reserve(m_mod_init.size() + 160);//currently 131 + for (auto& m : g_module_list) + { + m_mod_init.emplace_back(m.id, m.name); + } + cellAdec = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0006, cellAdec_init); + cellAtrac = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0013, cellAtrac_init); + cellAudio = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0011, cellAudio_init); + cellDmux = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0007, cellDmux_init); + cellFont = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0019, cellFont_init, cellFont_load, cellFont_unload); + sys_net = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back((u16)0x0000, sys_net_init); + sceNpTrophy = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload); + sceNp = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0016, sceNp_init); + cellUserInfo = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0032, cellUserInfo_init); + cellSysutil = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0015, cellSysutil_init); + cellSysutilAp = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0039, cellSysutilAp_init); + cellPngDec = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0018, cellPngDec_init); + cellNetCtl = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0014, cellNetCtl_init); + cellJpgDec = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x000f, cellJpgDec_init); + cellFontFT = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload); + cellGifDec = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0xf010, cellGifDec_init); + cellGcmSys = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload); + cellGame = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x003e, cellGame_init); + sys_io = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0017, sys_io_init); + cellL10n = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x001e, cellL10n_init); + cellPamf = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0012, cellPamf_init); + cellResc = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x001f, cellResc_init, cellResc_load, cellResc_unload); + cellRtc = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0009, cellRtc_init); + cellSpurs = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x000a, cellSpurs_init); + cellSync = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back("cellSync", cellSync_init); + cellSysmodule = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back("cellSysmodule", cellSysmodule_init); + cellVdec = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0005, cellVdec_init); + cellVpost = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x0008, cellVpost_init); + libmixer = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back("libmixer", libmixer_init); + sysPrxForUser = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back("sysPrxForUser", sysPrxForUser_init); + sys_fs = static_cast (&(m_mod_init.back())) + 1; + m_mod_init.emplace_back(0x000e, sys_fs_init); + initialized = true; + } +} + +ModuleManager::ModuleManager() : +m_max_module_id(0), +m_module_2_count(0), +initialized(false) +{ + memset(m_modules, 0, 3 * 0xFF * sizeof(Module*)); +} + +ModuleManager::~ModuleManager() +{ + m_mod_init.clear(); +} + +bool ModuleManager::IsLoadedFunc(u32 id) +{ + for (u32 i = 0; iid == id) + { + return true; + } + } + + return false; +} + +bool ModuleManager::CallFunc(u32 num) +{ + func_caller* func = nullptr; + { + std::lock_guard lock(m_funcs_lock); + + for (u32 i = 0; iid == num) + { + func = m_modules_funcs_list[i]->func; + break; + } + } + } + if (func) + { + (*func)(); + return true; + } + return false; +} + +bool ModuleManager::UnloadFunc(u32 id) +{ + std::lock_guard lock(m_funcs_lock); + + for (u32 i = 0; iid == id) + { + m_modules_funcs_list.erase(m_modules_funcs_list.begin() + i); + + return true; + } + } + + return false; +} + +u32 ModuleManager::GetFuncNumById(u32 id) +{ + return id; +} + +void ModuleManager::UnloadModules() +{ + for (u32 i = 0; i<3; ++i) + { + for (u32 j = 0; jUnLoad(); + } + } + } + + std::lock_guard lock(m_funcs_lock); + m_modules_funcs_list.clear(); +} + +Module* ModuleManager::GetModuleByName(const std::string& name) +{ + for (u32 i = 0; iGetName() == name) + { + return m_modules[0][i]; + } + + if (m_modules[1][i] && m_modules[1][i]->GetName() == name) + { + return m_modules[1][i]; + } + + if (m_modules[2][i] && m_modules[2][i]->GetName() == name) + { + return m_modules[2][i]; + } + } + + return nullptr; +} + +Module* ModuleManager::GetModuleById(u16 id) +{ + for (u32 i = 0; iGetID() == id) + { + return m_modules[0][i]; + } + + if (m_modules[1][i] && m_modules[1][i]->GetID() == id) + { + return m_modules[1][i]; + } + } + + return nullptr; +} + +void ModuleManager::SetModule(int id, Module* module, bool with_data) +{ + if (id != 0xffff) + { + if (u16((u8)id + 1) > m_max_module_id) + { + m_max_module_id = u16((u8)id + 1); + } + + int index; + switch (id >> 8) + { + case 0x00: index = 0; break; + case 0xf0: index = 1; break; + default: assert(0); return; + } + + if (m_modules[index][(u8)id]) + { + if (with_data) + { + module->SetName(m_modules[index][(u8)id]->GetName()); + // delete m_modules[index][(u8)id]; + m_modules[index][(u8)id] = module; + } + else + { + m_modules[index][(u8)id]->SetName(module->GetName()); + // delete module; + } + } + else + { + m_modules[index][(u8)id] = module; + } + } + else + { + m_modules[2][m_module_2_count++] = module; + + if (m_module_2_count > m_max_module_id) + { + m_max_module_id = m_module_2_count; + } + } +} + + +void ModuleManager::AddFunc(ModuleFunc *func) +{ + std::lock_guard guard(m_funcs_lock); + + if (!IsLoadedFunc(func->id)) + { + m_modules_funcs_list.push_back(func); + } +} + diff --git a/rpcs3/Emu/SysCalls/ModuleManager.h b/rpcs3/Emu/SysCalls/ModuleManager.h new file mode 100644 index 0000000000..e4a85c9958 --- /dev/null +++ b/rpcs3/Emu/SysCalls/ModuleManager.h @@ -0,0 +1,28 @@ +#pragma once +#include "Modules.h" + +class ModuleManager +{ + Module* m_modules[3][0xff]; + uint m_max_module_id; + uint m_module_2_count; + std::mutex m_funcs_lock; + std::vector m_modules_funcs_list; + std::vector m_mod_init; + bool initialized; +public: + ModuleManager(); + ~ModuleManager(); + + void init(); + void AddFunc(ModuleFunc *func); + void SetModule(int id, Module* module, bool with_data); + bool IsLoadedFunc(u32 id); + bool CallFunc(u32 num); + bool UnloadFunc(u32 id); + void UnloadModules(); + u32 GetFuncNumById(u32 id); + Module* GetModuleByName(const std::string& name); + Module* GetModuleById(u16 id); + +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index 836836be2b..158b451466 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -6,322 +6,11 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" #include +#include "Emu/System.h" +#include "ModuleManager.h" -Module* g_modules[3][0xff] = {0}; -uint g_max_module_id = 0; -uint g_module_2_count = 0; -std::vector g_modules_funcs_list; -std::mutex g_funcs_lock; -std::vector g_static_funcs_list; -struct ModuleInfo -{ - u32 id; - const char* name; -} -static const g_module_list[] = -{ - {0x0000, "sys_net"}, - {0x0001, "sys_http"}, - {0x0002, "cellHttpUtil"}, - {0x0003, "cellSsl"}, - {0x0004, "cellHttps"}, - {0x0005, "libvdec"}, - {0x0006, "cellAdec"}, - {0x0007, "cellDmux"}, - {0x0008, "cellVpost"}, - {0x0009, "cellRtc"}, - {0x000a, "cellSpurs"}, - {0x000b, "cellOvis"}, - {0x000c, "cellSheap"}, - {0x000d, "sys_sync"}, - {0x000e, "sys_fs"}, - {0x000f, "cellJpgDec"}, - {0x0010, "cellGcmSys"}, - {0x0011, "cellAudio"}, - {0x0012, "cellPamf"}, - {0x0013, "cellAtrac"}, - {0x0014, "cellNetCtl"}, - {0x0015, "cellSysutil"}, - {0x0016, "sceNp"}, - {0x0017, "sys_io"}, - {0x0018, "cellPngDec"}, - {0x0019, "cellFont"}, - {0x001a, "cellFontFT"}, - {0x001b, "cellFreetype"}, - {0x001c, "cellUsbd"}, - {0x001d, "cellSail"}, - {0x001e, "cellL10n"}, - {0x001f, "cellResc"}, - {0x0020, "cellDaisy"}, - {0x0021, "cellKey2char"}, - {0x0022, "cellMic"}, - {0x0023, "cellCamera"}, - {0x0024, "cellVdecMpeg2"}, - {0x0025, "cellVdecAvc"}, - {0x0026, "cellAdecLpcm"}, - {0x0027, "cellAdecAc3"}, - {0x0028, "cellAdecAtx"}, - {0x0029, "cellAdecAt3"}, - {0x002a, "cellDmuxPamf"}, - {0x002e, "cellLv2dbg"}, - {0x0030, "cellUsbpspcm"}, - {0x0031, "cellAvconfExt"}, - {0x0032, "cellUserInfo"}, - {0x0033, "cellSysutilSavedata"}, - {0x0034, "cellSubdisplay"}, - {0x0035, "cellSysutilRec"}, - {0x0036, "cellVideoExport"}, - {0x0037, "cellGameExec"}, - {0x0038, "sceNp2"}, - {0x0039, "cellSysutilAp"}, - {0x003a, "cellSysutilNpClans"}, - {0x003b, "cellSysutilOskExt"}, - {0x003c, "cellVdecDivx"}, - {0x003d, "cellJpgEnc"}, - {0x003e, "cellGame"}, - {0x003f, "cellBgdl"}, - {0x0040, "cellFreetypeTT"}, - {0x0041, "cellSysutilVideoUpload"}, - {0x0042, "cellSysutilSysconfExt"}, - {0x0043, "cellFiber"}, - {0x0044, "cellNpCommerce2"}, - {0x0045, "cellNpTus"}, - {0x0046, "cellVoice"}, - {0x0047, "cellAdecCelp8"}, - {0x0048, "cellCelp8Enc"}, - {0x0049, "cellLicenseArea"}, - {0x004a, "cellMusic2"}, - {0x004e, "cellScreenshot"}, - {0x004f, "cellMusicDecode"}, - {0x0050, "cellSpursJq"}, - {0x0052, "cellPngEnc"}, - {0x0053, "cellMusicDecode2"}, - {0x0055, "cellSync2"}, - {0x0056, "cellNpUtil"}, - {0x0057, "cellRudp"}, - {0x0059, "cellNpSns"}, - {0x005a, "cellGem"}, - {0xf00a, "cellCelpEnc"}, - {0xf010, "cellGifDec"}, - {0xf019, "cellAdecCelp"}, - {0xf01b, "cellAdecM2bc"}, - {0xf01d, "cellAdecM4aac"}, - {0xf01e, "cellAdecMp3"}, - {0xf023, "cellImejp"}, - {0xf028, "cellMusic"}, - {0xf029, "cellPhotoExport"}, - {0xf02a, "cellPrint"}, - {0xf02b, "cellPhotoImport"}, - {0xf02c, "cellMusicExport"}, - {0xf02e, "cellPhotoDecode"}, - {0xf02f, "cellSearch"}, - {0xf030, "cellAvchat2"}, - {0xf034, "cellSailRec"}, - {0xf035, "sceNpTrophy"}, - {0xf053, "cellAdecAt3multi"}, - {0xf054, "cellLibatrac3multi"} -}; - -struct _InitNullModules -{ - std::vector m_modules; - - _InitNullModules() - { - for(auto& m : g_module_list) - { - m_modules.push_back(new Module(m.id, m.name)); - } - } - - ~_InitNullModules() - { - for (int i = 0; i < m_modules.size(); ++i) - { - delete m_modules[i]; - } - } -} InitNullModules; - -/** HACK: Used to delete SFunc objects that get added to the global static function array (g_static_funcs_list). - * The destructor of this static object gets called when the program shuts down. - */ -struct StaticFunctionListCleaner_t -{ - StaticFunctionListCleaner_t() {} - ~StaticFunctionListCleaner_t() - { - for (int i = 0; i < g_static_funcs_list.size(); ++i) - { - delete g_static_funcs_list[i]; - } - } -} StaticFunctionListCleaner; - -bool IsLoadedFunc(u32 id) -{ - for(u32 i=0; iid == id) - { - return true; - } - } - - return false; -} - -bool CallFunc(u32 num) -{ - func_caller* func = nullptr; - { - std::lock_guard lock(g_funcs_lock); - - for(u32 i=0; iid == num) - { - func = g_modules_funcs_list[i]->func; - break; - } - } - } - if (func) - { - (*func)(); - return true; - } - return false; -} - -bool UnloadFunc(u32 id) -{ - std::lock_guard lock(g_funcs_lock); - - for(u32 i=0; iid == id) - { - g_modules_funcs_list.erase(g_modules_funcs_list.begin() +i); - - return true; - } - } - - return false; -} - -u32 GetFuncNumById(u32 id) -{ - return id; -} - -void UnloadModules() -{ - for(u32 i=0; i<3; ++i) - { - for(u32 j=0; jUnLoad(); - } - } - } - - std::lock_guard lock(g_funcs_lock); - g_modules_funcs_list.clear(); -} - -Module* GetModuleByName(const std::string& name) -{ - for(u32 i=0; iGetName() == name) - { - return g_modules[0][i]; - } - - if(g_modules[1][i] && g_modules[1][i]->GetName() == name) - { - return g_modules[1][i]; - } - - if(g_modules[2][i] && g_modules[2][i]->GetName() == name) - { - return g_modules[2][i]; - } - } - - return nullptr; -} - -Module* GetModuleById(u16 id) -{ - for(u32 i=0; iGetID() == id) - { - return g_modules[0][i]; - } - - if(g_modules[1][i] && g_modules[1][i]->GetID() == id) - { - return g_modules[1][i]; - } - } - - return nullptr; -} - -void SetModule(int id, Module* module, bool with_data) -{ - if(id != 0xffff) - { - if(u16((u8)id + 1) > g_max_module_id) - { - g_max_module_id = u16((u8)id + 1); - } - - int index; - switch(id >> 8) - { - case 0x00: index = 0; break; - case 0xf0: index = 1; break; - default: assert(0); return; - } - - if(g_modules[index][(u8)id]) - { - if(with_data) - { - module->SetName(g_modules[index][(u8)id]->GetName()); - // delete g_modules[index][(u8)id]; - g_modules[index][(u8)id] = module; - } - else - { - g_modules[index][(u8)id]->SetName(module->GetName()); - // delete module; - } - } - else - { - g_modules[index][(u8)id] = module; - } - } - else - { - g_modules[2][g_module_2_count++] = module; - - if(g_module_2_count > g_max_module_id) - { - g_max_module_id = g_module_2_count; - } - } -} Module::Module(u16 id, const char* name) : m_is_loaded(false) @@ -330,7 +19,7 @@ Module::Module(u16 id, const char* name) , m_load_func(nullptr) , m_unload_func(nullptr) { - SetModule(m_id, this, false); + Emu.GetModuleManager().SetModule(m_id, this, false); } Module::Module(const char* name, void (*init)(), void (*load)(), void (*unload)()) @@ -340,7 +29,7 @@ Module::Module(const char* name, void (*init)(), void (*load)(), void (*unload)( , m_load_func(load) , m_unload_func(unload) { - SetModule(m_id, this, init != nullptr); + Emu.GetModuleManager().SetModule(m_id, this, init != nullptr); if(init) init(); } @@ -350,10 +39,35 @@ Module::Module(u16 id, void (*init)(), void (*load)(), void (*unload)()) , m_load_func(load) , m_unload_func(unload) { - SetModule(m_id, this, init != nullptr); + Emu.GetModuleManager().SetModule(m_id, this, init != nullptr); if(init) init(); } +Module::Module(Module &&other) + : m_is_loaded(false) + , m_id(0) + , m_load_func(nullptr) + , m_unload_func(nullptr) +{ + std::swap(this->m_name,other.m_name); + std::swap(this->m_id, other.m_id); + std::swap(this->m_is_loaded, other.m_is_loaded); + std::swap(this->m_load_func, other.m_load_func); + std::swap(this->m_unload_func, other.m_unload_func); + std::swap(this->m_funcs_list, other.m_funcs_list); +} + +Module &Module::operator =(Module &&other) +{ + std::swap(this->m_name, other.m_name); + std::swap(this->m_id, other.m_id); + std::swap(this->m_is_loaded, other.m_is_loaded); + std::swap(this->m_load_func, other.m_load_func); + std::swap(this->m_unload_func, other.m_unload_func); + std::swap(this->m_funcs_list, other.m_funcs_list); + return *this; +} + Module::~Module() { UnLoad(); @@ -373,11 +87,7 @@ void Module::Load() for(u32 i=0; i lock(g_funcs_lock); - - if(IsLoadedFunc(m_funcs_list[i]->id)) continue; - - g_modules_funcs_list.push_back(m_funcs_list[i]); + Emu.GetModuleManager().AddFunc(m_funcs_list[i]); } SetLoaded(true); @@ -392,7 +102,7 @@ void Module::UnLoad() for(u32 i=0; iid); + Emu.GetModuleManager().UnloadFunc(m_funcs_list[i]->id); } SetLoaded(false); @@ -400,16 +110,16 @@ void Module::UnLoad() bool Module::Load(u32 id) { - std::lock_guard lock(g_funcs_lock); + //std::lock_guard lock(g_funcs_lock); - if(IsLoadedFunc(id)) return false; + if(Emu.GetModuleManager().IsLoadedFunc(id)) return false; for(u32 i=0; iid == id) { - g_modules_funcs_list.push_back(m_funcs_list[i]); - + //g_modules_funcs_list.push_back(m_funcs_list[i]); + Emu.GetModuleManager().AddFunc(m_funcs_list[i]); return true; } } @@ -419,7 +129,7 @@ bool Module::Load(u32 id) bool Module::UnLoad(u32 id) { - return UnloadFunc(id); + return Emu.GetModuleManager().UnloadFunc(id); } void Module::SetLoaded(bool loaded) diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index 8ed63b7f26..a558246faf 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -42,12 +42,10 @@ struct SFunc } }; -extern std::vector g_static_funcs_list; - class Module { std::string m_name; - const u16 m_id; + u16 m_id; bool m_is_loaded; void (*m_load_func)(); void (*m_unload_func)(); @@ -59,6 +57,12 @@ public: Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); Module(u16 id, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); + Module(Module &other) = delete; + Module(Module &&other); + + Module &operator =(Module &other) = delete; + Module &operator =(Module &&other); + ~Module(); void Load(); @@ -151,14 +155,6 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons op.crc = re(op.crc); sf->ops.push_back(op); } - g_static_funcs_list.push_back(sf); + Emu.GetSFuncManager().push_back(sf); } -bool IsLoadedFunc(u32 id); -bool CallFunc(u32 num); -bool UnloadFunc(u32 id); -void UnloadModules(); -u32 GetFuncNumById(u32 id); -Module* GetModuleByName(const std::string& name); -Module* GetModuleById(u16 id); - diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index 96f3f159b2..e5983c399e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -19,8 +19,9 @@ extern "C" #include "cellAdec.h" -void cellAdec_init(); -Module cellAdec(0x0006, cellAdec_init); +//void cellAdec_init(); +//Module cellAdec(0x0006, cellAdec_init); +extern Module *cellAdec=nullptr; int adecRawRead(void* opaque, u8* buf, int buf_size) { @@ -189,7 +190,7 @@ u32 adecOpen(AudioDecoder* data) adec.adecCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU); - u32 adec_id = cellAdec.GetNewId(data); + u32 adec_id = cellAdec->GetNewId(data); adec.id = adec_id; @@ -530,7 +531,7 @@ bool adecCheckType(AudioCodecType type) case CELL_ADEC_TYPE_CELP: case CELL_ADEC_TYPE_M4AAC: case CELL_ADEC_TYPE_CELP8: - cellAdec.Error("Unimplemented audio codec type (%d)", type); + cellAdec->Error("Unimplemented audio codec type (%d)", type); break; default: return false; @@ -541,7 +542,7 @@ bool adecCheckType(AudioCodecType type) int cellAdecQueryAttr(mem_ptr_t type, mem_ptr_t attr) { - cellAdec.Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); + cellAdec->Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); if (!type.IsGood() || !attr.IsGood()) { @@ -560,7 +561,7 @@ int cellAdecQueryAttr(mem_ptr_t type, mem_ptr_t attr int cellAdecOpen(mem_ptr_t type, mem_ptr_t res, mem_ptr_t cb, mem32_t handle) { - cellAdec.Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + cellAdec->Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) @@ -577,7 +578,7 @@ int cellAdecOpen(mem_ptr_t type, mem_ptr_t res, int cellAdecOpenEx(mem_ptr_t type, mem_ptr_t res, mem_ptr_t cb, mem32_t handle) { - cellAdec.Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + cellAdec->Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) @@ -594,7 +595,7 @@ int cellAdecOpenEx(mem_ptr_t type, mem_ptr_t r int cellAdecClose(u32 handle) { - cellAdec.Warning("cellAdecClose(handle=%d)", handle); + cellAdec->Warning("cellAdecClose(handle=%d)", handle); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -621,7 +622,7 @@ int cellAdecClose(u32 handle) int cellAdecStartSeq(u32 handle, u32 param_addr) { - cellAdec.Log("cellAdecStartSeq(handle=%d, param_addr=0x%x)", handle, param_addr); + cellAdec->Log("cellAdecStartSeq(handle=%d, param_addr=0x%x)", handle, param_addr); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -636,7 +637,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr) } else*/ { - cellAdec.Warning("cellAdecStartSeq: (TODO) initialization"); + cellAdec->Warning("cellAdecStartSeq: (TODO) initialization"); } adec->job.Push(task); @@ -645,7 +646,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr) int cellAdecEndSeq(u32 handle) { - cellAdec.Warning("cellAdecEndSeq(handle=%d)", handle); + cellAdec->Warning("cellAdecEndSeq(handle=%d)", handle); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -659,7 +660,7 @@ int cellAdecEndSeq(u32 handle) int cellAdecDecodeAu(u32 handle, mem_ptr_t auInfo) { - cellAdec.Log("cellAdecDecodeAu(handle=%d, auInfo_addr=0x%x)", handle, auInfo.GetAddr()); + cellAdec->Log("cellAdecDecodeAu(handle=%d, auInfo_addr=0x%x)", handle, auInfo.GetAddr()); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -685,7 +686,7 @@ int cellAdecDecodeAu(u32 handle, mem_ptr_t auInfo) int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) { - cellAdec.Log("cellAdecGetPcm(handle=%d, outBuffer_addr=0x%x)", handle, outBuffer_addr); + cellAdec->Log("cellAdecGetPcm(handle=%d, outBuffer_addr=0x%x)", handle, outBuffer_addr); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -775,7 +776,7 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr) { - cellAdec.Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.GetAddr()); + cellAdec->Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.GetAddr()); AudioDecoder* adec; if (!Emu.GetIdManager().GetIDData(handle, adec)) @@ -828,15 +829,15 @@ int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr) void cellAdec_init() { - cellAdec.AddFunc(0x7e4a4a49, cellAdecQueryAttr); - cellAdec.AddFunc(0xd00a6988, cellAdecOpen); - cellAdec.AddFunc(0x8b5551a4, cellAdecOpenEx); - cellAdec.AddFunc(0x847d2380, cellAdecClose); - cellAdec.AddFunc(0x487b613e, cellAdecStartSeq); - cellAdec.AddFunc(0xe2ea549b, cellAdecEndSeq); - cellAdec.AddFunc(0x1529e506, cellAdecDecodeAu); - cellAdec.AddFunc(0x97ff2af1, cellAdecGetPcm); - cellAdec.AddFunc(0xbd75f78b, cellAdecGetPcmItem); + cellAdec->AddFunc(0x7e4a4a49, cellAdecQueryAttr); + cellAdec->AddFunc(0xd00a6988, cellAdecOpen); + cellAdec->AddFunc(0x8b5551a4, cellAdecOpenEx); + cellAdec->AddFunc(0x847d2380, cellAdecClose); + cellAdec->AddFunc(0x487b613e, cellAdecStartSeq); + cellAdec->AddFunc(0xe2ea549b, cellAdecEndSeq); + cellAdec->AddFunc(0x1529e506, cellAdecDecodeAu); + cellAdec->AddFunc(0x97ff2af1, cellAdecGetPcm); + cellAdec->AddFunc(0xbd75f78b, cellAdecGetPcmItem); av_register_all(); avcodec_register_all(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp index 6a95c1c3a2..b170e3073e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp @@ -7,14 +7,13 @@ #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" -void cellAtrac_init(); -Module cellAtrac(0x0013, cellAtrac_init); +extern Module *cellAtrac = nullptr; #include "cellAtrac.h" int cellAtracSetDataAndGetMemSize(mem_ptr_t pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, mem32_t puiWorkMemByte) { - cellAtrac.Error("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)", + cellAtrac->Error("cellAtracSetDataAndGetMemSize(pHandle=0x%x, pucBufferAddr=0x%x, uiReadByte=0x%x, uiBufferByte=0x%x, puiWorkMemByte_addr=0x%x)", pHandle.GetAddr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.GetAddr()); puiWorkMemByte = 0x1000; // unproved @@ -23,7 +22,7 @@ int cellAtracSetDataAndGetMemSize(mem_ptr_t pHandle, u32 pucBuf int cellAtracCreateDecoder(mem_ptr_t pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority) { - cellAtrac.Error("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)", + cellAtrac->Error("cellAtracCreateDecoder(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, uiSpuThreadPriority=%d)", pHandle.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority); pHandle->data.pucWorkMem_addr = pucWorkMem_addr; @@ -32,7 +31,7 @@ int cellAtracCreateDecoder(mem_ptr_t pHandle, u32 pucWorkMem_ad int cellAtracCreateDecoderExt(mem_ptr_t pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, mem_ptr_t pExtRes) { - cellAtrac.Error("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)", + cellAtrac->Error("cellAtracCreateDecoderExt(pHandle=0x%x, pucWorkMem_addr=0x%x, uiPpuThreadPriority=%d, pExtRes_addr=0x%x)", pHandle.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.GetAddr()); pHandle->data.pucWorkMem_addr = pucWorkMem_addr; @@ -41,13 +40,13 @@ int cellAtracCreateDecoderExt(mem_ptr_t pHandle, u32 pucWorkMem int cellAtracDeleteDecoder(mem_ptr_t pHandle) { - cellAtrac.Error("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr()); + cellAtrac->Error("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr()); return CELL_OK; } int cellAtracDecode(mem_ptr_t pHandle, u32 pfOutAddr, mem32_t puiSamples, mem32_t puiFinishflag, mem32_t piRemainFrame) { - cellAtrac.Error("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)", + cellAtrac->Error("cellAtracDecode(pHandle=0x%x, pfOutAddr=0x%x, puiSamples_addr=0x%x, puiFinishFlag_addr=0x%x, piRemainFrame_addr=0x%x)", pHandle.GetAddr(), pfOutAddr, puiSamples.GetAddr(), puiFinishflag.GetAddr(), piRemainFrame.GetAddr()); puiSamples = 0; @@ -58,7 +57,7 @@ int cellAtracDecode(mem_ptr_t pHandle, u32 pfOutAddr, mem32_t p int cellAtracGetStreamDataInfo(mem_ptr_t pHandle, mem32_t ppucWritePointer, mem32_t puiWritableByte, mem32_t puiReadPosition) { - cellAtrac.Error("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)", + cellAtrac->Error("cellAtracGetStreamDataInfo(pHandle=0x%x, ppucWritePointer_addr=0x%x, puiWritableByte_addr=0x%x, puiReadPosition_addr=0x%x)", pHandle.GetAddr(), ppucWritePointer.GetAddr(), puiWritableByte.GetAddr(), puiReadPosition.GetAddr()); ppucWritePointer = pHandle->data.pucWorkMem_addr; @@ -69,13 +68,13 @@ int cellAtracGetStreamDataInfo(mem_ptr_t pHandle, mem32_t ppucW int cellAtracAddStreamData(mem_ptr_t pHandle, u32 uiAddByte) { - cellAtrac.Error("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.GetAddr(), uiAddByte); + cellAtrac->Error("cellAtracAddStreamData(pHandle=0x%x, uiAddByte=0x%x)", pHandle.GetAddr(), uiAddByte); return CELL_OK; } int cellAtracGetRemainFrame(mem_ptr_t pHandle, mem32_t piRemainFrame) { - cellAtrac.Error("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.GetAddr(), piRemainFrame.GetAddr()); + cellAtrac->Error("cellAtracGetRemainFrame(pHandle=0x%x, piRemainFrame_addr=0x%x)", pHandle.GetAddr(), piRemainFrame.GetAddr()); piRemainFrame = CELL_ATRAC_ALLDATA_IS_ON_MEMORY; return CELL_OK; @@ -83,7 +82,7 @@ int cellAtracGetRemainFrame(mem_ptr_t pHandle, mem32_t piRemain int cellAtracGetVacantSize(mem_ptr_t pHandle, mem32_t puiVacantSize) { - cellAtrac.Error("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.GetAddr(), puiVacantSize.GetAddr()); + cellAtrac->Error("cellAtracGetVacantSize(pHandle=0x%x, puiVacantSize_addr=0x%x)", pHandle.GetAddr(), puiVacantSize.GetAddr()); puiVacantSize = 0x1000; return CELL_OK; @@ -91,13 +90,13 @@ int cellAtracGetVacantSize(mem_ptr_t pHandle, mem32_t puiVacant int cellAtracIsSecondBufferNeeded(mem_ptr_t pHandle) { - cellAtrac.Error("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr()); + cellAtrac->Error("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr()); return CELL_OK; } int cellAtracGetSecondBufferInfo(mem_ptr_t pHandle, mem32_t puiReadPosition, mem32_t puiDataByte) { - cellAtrac.Error("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)", + cellAtrac->Error("cellAtracGetSecondBufferInfo(pHandle=0x%x, puiReadPosition_addr=0x%x, puiDataByte_addr=0x%x)", pHandle.GetAddr(), puiReadPosition.GetAddr(), puiDataByte.GetAddr()); puiReadPosition = 0; @@ -107,14 +106,14 @@ int cellAtracGetSecondBufferInfo(mem_ptr_t pHandle, mem32_t pui int cellAtracSetSecondBuffer(mem_ptr_t pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte) { - cellAtrac.Error("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)", + cellAtrac->Error("cellAtracSetSecondBuffer(pHandle=0x%x, pucSecondBufferAddr=0x%x, uiSecondBufferByte=0x%x)", pHandle.GetAddr(), pucSecondBufferAddr, uiSecondBufferByte); return CELL_OK; } int cellAtracGetChannel(mem_ptr_t pHandle, mem32_t puiChannel) { - cellAtrac.Error("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.GetAddr(), puiChannel.GetAddr()); + cellAtrac->Error("cellAtracGetChannel(pHandle=0x%x, puiChannel_addr=0x%x)", pHandle.GetAddr(), puiChannel.GetAddr()); puiChannel = 2; return CELL_OK; @@ -122,7 +121,7 @@ int cellAtracGetChannel(mem_ptr_t pHandle, mem32_t puiChannel) int cellAtracGetMaxSample(mem_ptr_t pHandle, mem32_t puiMaxSample) { - cellAtrac.Error("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.GetAddr(), puiMaxSample.GetAddr()); + cellAtrac->Error("cellAtracGetMaxSample(pHandle=0x%x, puiMaxSample_addr=0x%x)", pHandle.GetAddr(), puiMaxSample.GetAddr()); puiMaxSample = 512; return CELL_OK; @@ -130,7 +129,7 @@ int cellAtracGetMaxSample(mem_ptr_t pHandle, mem32_t puiMaxSamp int cellAtracGetNextSample(mem_ptr_t pHandle, mem32_t puiNextSample) { - cellAtrac.Error("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.GetAddr(), puiNextSample.GetAddr()); + cellAtrac->Error("cellAtracGetNextSample(pHandle=0x%x, puiNextSample_addr=0x%x)", pHandle.GetAddr(), puiNextSample.GetAddr()); puiNextSample = 0; return CELL_OK; @@ -138,7 +137,7 @@ int cellAtracGetNextSample(mem_ptr_t pHandle, mem32_t puiNextSa int cellAtracGetSoundInfo(mem_ptr_t pHandle, mem32_t piEndSample, mem32_t piLoopStartSample, mem32_t piLoopEndSample) { - cellAtrac.Error("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)", + cellAtrac->Error("cellAtracGetSoundInfo(pHandle=0x%x, piEndSample_addr=0x%x, piLoopStartSample_addr=0x%x, piLoopEndSample_addr=0x%x)", pHandle.GetAddr(), piEndSample.GetAddr(), piLoopStartSample.GetAddr(), piLoopEndSample.GetAddr()); piEndSample = 0; @@ -149,7 +148,7 @@ int cellAtracGetSoundInfo(mem_ptr_t pHandle, mem32_t piEndSampl int cellAtracGetNextDecodePosition(mem_ptr_t pHandle, mem32_t puiSamplePosition) { - cellAtrac.Error("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)", + cellAtrac->Error("cellAtracGetNextDecodePosition(pHandle=0x%x, puiSamplePosition_addr=0x%x)", pHandle.GetAddr(), puiSamplePosition.GetAddr()); puiSamplePosition = 0; @@ -158,7 +157,7 @@ int cellAtracGetNextDecodePosition(mem_ptr_t pHandle, mem32_t p int cellAtracGetBitrate(mem_ptr_t pHandle, mem32_t puiBitrate) { - cellAtrac.Error("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)", + cellAtrac->Error("cellAtracGetBitrate(pHandle=0x%x, puiBitrate_addr=0x%x)", pHandle.GetAddr(), puiBitrate.GetAddr()); puiBitrate = 128; @@ -167,7 +166,7 @@ int cellAtracGetBitrate(mem_ptr_t pHandle, mem32_t puiBitrate) int cellAtracGetLoopInfo(mem_ptr_t pHandle, mem32_t piLoopNum, mem32_t puiLoopStatus) { - cellAtrac.Error("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)", + cellAtrac->Error("cellAtracGetLoopInfo(pHandle=0x%x, piLoopNum_addr=0x%x, puiLoopStatus_addr=0x%x)", pHandle.GetAddr(), piLoopNum.GetAddr(), puiLoopStatus.GetAddr()); piLoopNum = 0; @@ -177,13 +176,13 @@ int cellAtracGetLoopInfo(mem_ptr_t pHandle, mem32_t piLoopNum, int cellAtracSetLoopNum(mem_ptr_t pHandle, int iLoopNum) { - cellAtrac.Error("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.GetAddr(), iLoopNum); + cellAtrac->Error("cellAtracSetLoopNum(pHandle=0x%x, iLoopNum=0x%x)", pHandle.GetAddr(), iLoopNum); return CELL_OK; } int cellAtracGetBufferInfoForResetting(mem_ptr_t pHandle, u32 uiSample, mem_ptr_t pBufferInfo) { - cellAtrac.Error("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)", + cellAtrac->Error("cellAtracGetBufferInfoForResetting(pHandle=0x%x, uiSample=0x%x, pBufferInfo_addr=0x%x)", pHandle.GetAddr(), uiSample, pBufferInfo.GetAddr()); pBufferInfo->pucWriteAddr = pHandle->data.pucWorkMem_addr; @@ -195,14 +194,14 @@ int cellAtracGetBufferInfoForResetting(mem_ptr_t pHandle, u32 u int cellAtracResetPlayPosition(mem_ptr_t pHandle, u32 uiSample, u32 uiWriteByte) { - cellAtrac.Error("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)", + cellAtrac->Error("cellAtracResetPlayPosition(pHandle=0x%x, uiSample=0x%x, uiWriteByte=0x%x)", pHandle.GetAddr(), uiSample, uiWriteByte); return CELL_OK; } int cellAtracGetInternalErrorInfo(mem_ptr_t pHandle, mem32_t piResult) { - cellAtrac.Error("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)", + cellAtrac->Error("cellAtracGetInternalErrorInfo(pHandle=0x%x, piResult_addr=0x%x)", pHandle.GetAddr(), piResult.GetAddr()); piResult = 0; @@ -211,34 +210,34 @@ int cellAtracGetInternalErrorInfo(mem_ptr_t pHandle, mem32_t pi void cellAtrac_init() { - cellAtrac.AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize); + cellAtrac->AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize); - cellAtrac.AddFunc(0xfa293e88, cellAtracCreateDecoder); - cellAtrac.AddFunc(0x2642d4cc, cellAtracCreateDecoderExt); - cellAtrac.AddFunc(0x761cb9be, cellAtracDeleteDecoder); + cellAtrac->AddFunc(0xfa293e88, cellAtracCreateDecoder); + cellAtrac->AddFunc(0x2642d4cc, cellAtracCreateDecoderExt); + cellAtrac->AddFunc(0x761cb9be, cellAtracDeleteDecoder); - cellAtrac.AddFunc(0x8eb0e65f, cellAtracDecode); + cellAtrac->AddFunc(0x8eb0e65f, cellAtracDecode); - cellAtrac.AddFunc(0x2bfff084, cellAtracGetStreamDataInfo); - cellAtrac.AddFunc(0x46cfc013, cellAtracAddStreamData); - cellAtrac.AddFunc(0xdfab73aa, cellAtracGetRemainFrame); - cellAtrac.AddFunc(0xc9a95fcb, cellAtracGetVacantSize); - cellAtrac.AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded); - cellAtrac.AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo); - cellAtrac.AddFunc(0x06ddb53e, cellAtracSetSecondBuffer); + cellAtrac->AddFunc(0x2bfff084, cellAtracGetStreamDataInfo); + cellAtrac->AddFunc(0x46cfc013, cellAtracAddStreamData); + cellAtrac->AddFunc(0xdfab73aa, cellAtracGetRemainFrame); + cellAtrac->AddFunc(0xc9a95fcb, cellAtracGetVacantSize); + cellAtrac->AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded); + cellAtrac->AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo); + cellAtrac->AddFunc(0x06ddb53e, cellAtracSetSecondBuffer); - cellAtrac.AddFunc(0x0f9667b6, cellAtracGetChannel); - cellAtrac.AddFunc(0x5f62d546, cellAtracGetMaxSample); - cellAtrac.AddFunc(0x4797d1ff, cellAtracGetNextSample); - cellAtrac.AddFunc(0xcf01d5d4, cellAtracGetSoundInfo); - cellAtrac.AddFunc(0x7b22e672, cellAtracGetNextDecodePosition); - cellAtrac.AddFunc(0x006016da, cellAtracGetBitrate); + cellAtrac->AddFunc(0x0f9667b6, cellAtracGetChannel); + cellAtrac->AddFunc(0x5f62d546, cellAtracGetMaxSample); + cellAtrac->AddFunc(0x4797d1ff, cellAtracGetNextSample); + cellAtrac->AddFunc(0xcf01d5d4, cellAtracGetSoundInfo); + cellAtrac->AddFunc(0x7b22e672, cellAtracGetNextDecodePosition); + cellAtrac->AddFunc(0x006016da, cellAtracGetBitrate); - cellAtrac.AddFunc(0xab6b6dbf, cellAtracGetLoopInfo); - cellAtrac.AddFunc(0x78ba5c41, cellAtracSetLoopNum); + cellAtrac->AddFunc(0xab6b6dbf, cellAtracGetLoopInfo); + cellAtrac->AddFunc(0x78ba5c41, cellAtracSetLoopNum); - cellAtrac.AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting); - cellAtrac.AddFunc(0x7772eb2b, cellAtracResetPlayPosition); + cellAtrac->AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting); + cellAtrac->AddFunc(0x7772eb2b, cellAtracResetPlayPosition); - cellAtrac.AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo); + cellAtrac->AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index cc0afca787..1e9d2af4ad 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -11,8 +11,9 @@ #include "Emu/Audio/AudioManager.h" #include "Emu/Audio/AudioDumper.h" -void cellAudio_init(); -Module cellAudio(0x0011, cellAudio_init); +//void cellAudio_init(); +//Module cellAudio(0x0011, cellAudio_init); +extern Module *cellAudio = nullptr; static SMutexGeneral audioMutex; @@ -24,7 +25,7 @@ static const bool g_is_u16 = Ini.AudioConvertToU16.GetValue(); int cellAudioInit() { - cellAudio.Warning("cellAudioInit()"); + cellAudio->Warning("cellAudioInit()"); if (m_config.m_is_audio_initialized) { @@ -490,7 +491,7 @@ abort: int cellAudioQuit() { - cellAudio.Warning("cellAudioQuit()"); + cellAudio->Warning("cellAudioQuit()"); if (!m_config.m_is_audio_initialized) { @@ -517,7 +518,7 @@ int cellAudioQuit() int cellAudioPortOpen(mem_ptr_t 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()); if(!audioParam.IsGood() || !portNum.IsGood()) { @@ -553,7 +554,7 @@ int cellAudioPortOpen(mem_ptr_t audioParam, mem32_t portNum) } portNum = i; - cellAudio.Warning("*** audio port opened(nChannel=%d, nBlock=%d, attr=0x%llx, level=%f): port = %d", + cellAudio->Warning("*** audio port opened(nChannel=%d, nBlock=%d, attr=0x%llx, level=%f): port = %d", port.channel, port.block, port.attr, port.level, i); port.m_is_audio_port_opened = true; @@ -570,7 +571,7 @@ int cellAudioPortOpen(mem_ptr_t audioParam, mem32_t portNum) int cellAudioGetPortConfig(u32 portNum, mem_ptr_t portConfig) { - cellAudio.Warning("cellAudioGetPortConfig(portNum=0x%x, portConfig_addr=0x%x)", portNum, portConfig.GetAddr()); + cellAudio->Warning("cellAudioGetPortConfig(portNum=0x%x, portConfig_addr=0x%x)", portNum, portConfig.GetAddr()); if (!portConfig.IsGood() || portNum >= m_config.AUDIO_PORT_COUNT) { @@ -598,7 +599,7 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t portConfi portConfig->portAddr = m_config.m_buffer + (128 * 1024 * portNum); // 0x20020000 portConfig->readIndexAddr = m_config.m_indexes + (sizeof(u64) * portNum); // 0x20010010 on ps3 - cellAudio.Log("*** port config: nChannel=%d, nBlock=%d, portSize=0x%x, portAddr=0x%x, readIndexAddr=0x%x", + 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); // portAddr - readIndexAddr == 0xFFF0 on ps3 @@ -607,7 +608,7 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t portConfi int cellAudioPortStart(u32 portNum) { - cellAudio.Warning("cellAudioPortStart(portNum=0x%x)", portNum); + cellAudio->Warning("cellAudioPortStart(portNum=0x%x)", portNum); if (portNum >= m_config.AUDIO_PORT_COUNT) { @@ -631,7 +632,7 @@ int cellAudioPortStart(u32 portNum) int cellAudioPortClose(u32 portNum) { - cellAudio.Warning("cellAudioPortClose(portNum=0x%x)", portNum); + cellAudio->Warning("cellAudioPortClose(portNum=0x%x)", portNum); if (portNum >= m_config.AUDIO_PORT_COUNT) { @@ -651,7 +652,7 @@ int cellAudioPortClose(u32 portNum) int cellAudioPortStop(u32 portNum) { - cellAudio.Warning("cellAudioPortStop(portNum=0x%x)",portNum); + cellAudio->Warning("cellAudioPortStop(portNum=0x%x)",portNum); if (portNum >= m_config.AUDIO_PORT_COUNT) { @@ -674,7 +675,7 @@ int cellAudioPortStop(u32 portNum) int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp) { - cellAudio.Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.GetAddr()); + cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.GetAddr()); if (portNum >= m_config.AUDIO_PORT_COUNT) { @@ -702,7 +703,7 @@ int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp) int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag) { - cellAudio.Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.GetAddr()); + cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.GetAddr()); if (portNum >= m_config.AUDIO_PORT_COUNT) { @@ -723,7 +724,7 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag) if (blockNo >= port.block) { - cellAudio.Error("cellAudioGetPortBlockTag: wrong blockNo(%lld)", blockNo); + cellAudio->Error("cellAudioGetPortBlockTag: wrong blockNo(%lld)", blockNo); return CELL_AUDIO_ERROR_PARAM; } @@ -746,14 +747,14 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag) int cellAudioSetPortLevel(u32 portNum, float level) { - cellAudio.Error("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level); + cellAudio->Error("cellAudioSetPortLevel(portNum=0x%x, level=%f)", portNum, level); return CELL_OK; } // Utility Functions int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key) { - cellAudio.Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr()); + cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr()); SMutexGeneralLocker lock(audioMutex); @@ -773,7 +774,7 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key) return CELL_AUDIO_ERROR_EVENT_QUEUE; } - id = cellAudio.GetNewId(eq); + id = cellAudio->GetNewId(eq); key = event_key; return CELL_OK; @@ -781,13 +782,13 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key) int cellAudioCreateNotifyEventQueueEx(mem32_t id, mem64_t key, u32 iFlags) { - cellAudio.Error("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.GetAddr(), iFlags); + cellAudio->Error("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.GetAddr(), iFlags); return CELL_OK; } int cellAudioSetNotifyEventQueue(u64 key) { - cellAudio.Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key); + cellAudio->Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key); SMutexGeneralLocker lock(audioMutex); @@ -813,13 +814,13 @@ int cellAudioSetNotifyEventQueue(u64 key) int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags) { - cellAudio.Error("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); + cellAudio->Error("cellAudioSetNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); return CELL_OK; } int cellAudioRemoveNotifyEventQueue(u64 key) { - cellAudio.Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key); + cellAudio->Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key); SMutexGeneralLocker lock(audioMutex); @@ -853,68 +854,68 @@ int cellAudioRemoveNotifyEventQueue(u64 key) int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags) { - cellAudio.Error("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); + cellAudio->Error("cellAudioRemoveNotifyEventQueueEx(key=0x%llx, iFlags=0x%x)", key, iFlags); return CELL_OK; } int cellAudioAddData(u32 portNum, mem32_t src, u32 samples, float volume) { - cellAudio.Error("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume); + cellAudio->Error("cellAudioAddData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume); return CELL_OK; } int cellAudioAdd2chData(u32 portNum, mem32_t src, u32 samples, float volume) { - cellAudio.Error("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume); + cellAudio->Error("cellAudioAdd2chData(portNum=0x%x, src_addr=0x%x, samples=%d, volume=%f)", portNum, src.GetAddr(), samples, volume); return CELL_OK; } int cellAudioAdd6chData(u32 portNum, mem32_t src, float volume) { - cellAudio.Error("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.GetAddr(), volume); + cellAudio->Error("cellAudioAdd6chData(portNum=0x%x, src_addr=0x%x, volume=%f)", portNum, src.GetAddr(), volume); return CELL_OK; } int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume) { - cellAudio.Error("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume); + cellAudio->Error("cellAudioMiscSetAccessoryVolume(devNum=0x%x, volume=%f)", devNum, volume); return CELL_OK; } int cellAudioSendAck(u64 data3) { - cellAudio.Error("cellAudioSendAck(data3=0x%llx)", data3); + cellAudio->Error("cellAudioSendAck(data3=0x%llx)", data3); return CELL_OK; } int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice) { - cellAudio.Error("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice); + cellAudio->Error("cellAudioSetPersonalDevice(iPersonalStream=0x%x, iDevice=0x%x)", iPersonalStream, iDevice); return CELL_OK; } int cellAudioUnsetPersonalDevice(int iPersonalStream) { - cellAudio.Error("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream); + cellAudio->Error("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream); return CELL_OK; } void cellAudio_init() { - cellAudio.AddFunc(0x0b168f92, cellAudioInit); - cellAudio.AddFunc(0x4129fe2d, cellAudioPortClose); - cellAudio.AddFunc(0x5b1e2c73, cellAudioPortStop); - cellAudio.AddFunc(0x74a66af0, cellAudioGetPortConfig); - cellAudio.AddFunc(0x89be28f2, cellAudioPortStart); - cellAudio.AddFunc(0xca5ac370, cellAudioQuit); - cellAudio.AddFunc(0xcd7bc431, cellAudioPortOpen); - cellAudio.AddFunc(0x56dfe179, cellAudioSetPortLevel); - cellAudio.AddFunc(0x04af134e, cellAudioCreateNotifyEventQueue); - cellAudio.AddFunc(0x31211f6b, cellAudioMiscSetAccessoryVolume); - cellAudio.AddFunc(0x377e0cd9, cellAudioSetNotifyEventQueue); - cellAudio.AddFunc(0x4109d08c, cellAudioGetPortTimestamp); - cellAudio.AddFunc(0x9e4b1db8, cellAudioAdd2chData); - cellAudio.AddFunc(0xdab029aa, cellAudioAddData); - cellAudio.AddFunc(0xe4046afe, cellAudioGetPortBlockTag); - cellAudio.AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue); + cellAudio->AddFunc(0x0b168f92, cellAudioInit); + cellAudio->AddFunc(0x4129fe2d, cellAudioPortClose); + cellAudio->AddFunc(0x5b1e2c73, cellAudioPortStop); + cellAudio->AddFunc(0x74a66af0, cellAudioGetPortConfig); + cellAudio->AddFunc(0x89be28f2, cellAudioPortStart); + cellAudio->AddFunc(0xca5ac370, cellAudioQuit); + cellAudio->AddFunc(0xcd7bc431, cellAudioPortOpen); + cellAudio->AddFunc(0x56dfe179, cellAudioSetPortLevel); + cellAudio->AddFunc(0x04af134e, cellAudioCreateNotifyEventQueue); + cellAudio->AddFunc(0x31211f6b, cellAudioMiscSetAccessoryVolume); + cellAudio->AddFunc(0x377e0cd9, cellAudioSetNotifyEventQueue); + cellAudio->AddFunc(0x4109d08c, cellAudioGetPortTimestamp); + cellAudio->AddFunc(0x9e4b1db8, cellAudioAdd2chData); + cellAudio->AddFunc(0xdab029aa, cellAudioAddData); + cellAudio->AddFunc(0xe4046afe, cellAudioGetPortBlockTag); + cellAudio->AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp index 90ba783cbf..80bea81089 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellCelpEnc.cpp @@ -83,4 +83,4 @@ void cellCelpEnc_init() cellCelpEnc.AddFunc(0x9b244272, cellCelpEncWaitForOutput); cellCelpEnc.AddFunc(0x3773692f, cellCelpEncGetAu); } -#endif +#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index 9a636263e0..0abaed44aa 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -10,8 +10,9 @@ #include "cellPamf.h" #include "cellDmux.h" -void cellDmux_init(); -Module cellDmux(0x0007, cellDmux_init); +//void cellDmux_init(); +//Module cellDmux(0x0007, cellDmux_init); +Module *cellDmux = nullptr; void dmuxQueryAttr(u32 info_addr /* may be 0 */, mem_ptr_t attr) { @@ -28,7 +29,7 @@ void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, const mem_ptr_tmemSize = 0x8000; // 0x73d9 from ps3 - cellDmux.Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor, + cellDmux->Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor, (u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2); } @@ -38,7 +39,7 @@ u32 dmuxOpen(Demuxer* data) dmux.dmuxCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU); - u32 dmux_id = cellDmux.GetNewId(data); + u32 dmux_id = cellDmux->GetNewId(data); dmux.id = dmux_id; @@ -463,7 +464,7 @@ u32 dmuxOpen(Demuxer* data) int cellDmuxQueryAttr(const mem_ptr_t demuxerType, mem_ptr_t demuxerAttr) { - cellDmux.Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.GetAddr(), demuxerAttr.GetAddr()); + cellDmux->Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.GetAddr(), demuxerAttr.GetAddr()); if (!demuxerType.IsGood() || !demuxerAttr.IsGood()) { @@ -481,7 +482,7 @@ int cellDmuxQueryAttr(const mem_ptr_t demuxerType, mem_ptr_t demuxerType2, mem_ptr_t demuxerAttr) { - cellDmux.Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.GetAddr(), demuxerAttr.GetAddr()); + cellDmux->Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.GetAddr(), demuxerAttr.GetAddr()); if (!demuxerType2.IsGood() || !demuxerAttr.IsGood()) { @@ -500,7 +501,7 @@ int cellDmuxQueryAttr2(const mem_ptr_t demuxerType2, mem_ptr_t demuxerType, const mem_ptr_t demuxerResource, const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { - cellDmux.Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", + cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", demuxerType.GetAddr(), demuxerResource.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); if (!demuxerType.IsGood() || !demuxerResource.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) @@ -528,7 +529,7 @@ int cellDmuxOpen(const mem_ptr_t demuxerType, const mem_ptr_t demuxerType, const mem_ptr_t demuxerResourceEx, const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { - cellDmux.Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", + cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", demuxerType.GetAddr(), demuxerResourceEx.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); if (!demuxerType.IsGood() || !demuxerResourceEx.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) @@ -556,7 +557,7 @@ int cellDmuxOpenEx(const mem_ptr_t demuxerType, const mem_ptr_t demuxerType2, const mem_ptr_t demuxerResource2, const mem_ptr_t demuxerCb, mem32_t demuxerHandle) { - cellDmux.Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", + cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", demuxerType2.GetAddr(), demuxerResource2.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr()); if (!demuxerType2.IsGood() || !demuxerResource2.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) @@ -583,7 +584,7 @@ int cellDmuxOpen2(const mem_ptr_t demuxerType2, const mem_ptr_tWarning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle); Demuxer* dmux; if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) @@ -611,7 +612,7 @@ int cellDmuxClose(u32 demuxerHandle) int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) { - cellDmux.Log("cellDmuxSetStream(demuxerHandle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", + cellDmux->Log("cellDmuxSetStream(demuxerHandle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", demuxerHandle, streamAddress, streamSize, discontinuity, userData); Demuxer* dmux; @@ -661,7 +662,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize int cellDmuxResetStream(u32 demuxerHandle) { - cellDmux.Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle); + cellDmux->Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle); Demuxer* dmux; if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) @@ -676,7 +677,7 @@ int cellDmuxResetStream(u32 demuxerHandle) int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) { - cellDmux.Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle); + cellDmux->Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle); Demuxer* dmux; if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) @@ -703,7 +704,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) int cellDmuxQueryEsAttr(const mem_ptr_t demuxerType, const mem_ptr_t esFilterId, const u32 esSpecificInfo_addr, mem_ptr_t esAttr) { - cellDmux.Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", + cellDmux->Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", demuxerType.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr()); if (!demuxerType.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood()) @@ -713,7 +714,7 @@ int cellDmuxQueryEsAttr(const mem_ptr_t demuxerType, const mem_ptr if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) { - cellDmux.Error("cellDmuxQueryEsAttr: invalid specific info addr (0x%x)", esSpecificInfo_addr); + cellDmux->Error("cellDmuxQueryEsAttr: invalid specific info addr (0x%x)", esSpecificInfo_addr); return CELL_DMUX_ERROR_FATAL; } @@ -731,7 +732,7 @@ int cellDmuxQueryEsAttr(const mem_ptr_t demuxerType, const mem_ptr int cellDmuxQueryEsAttr2(const mem_ptr_t demuxerType2, const mem_ptr_t esFilterId, const u32 esSpecificInfo_addr, mem_ptr_t esAttr) { - cellDmux.Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", + cellDmux->Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", demuxerType2.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr()); if (!demuxerType2.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood()) @@ -741,7 +742,7 @@ int cellDmuxQueryEsAttr2(const mem_ptr_t demuxerType2, const mem_ if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) { - cellDmux.Error("cellDmuxQueryEsAttr2: invalid specific info addr (0x%x)", esSpecificInfo_addr); + cellDmux->Error("cellDmuxQueryEsAttr2: invalid specific info addr (0x%x)", esSpecificInfo_addr); return CELL_DMUX_ERROR_FATAL; } @@ -760,7 +761,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t esF const mem_ptr_t esResourceInfo, const mem_ptr_t esCb, const u32 esSpecificInfo_addr, mem32_t esHandle) { - cellDmux.Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " + cellDmux->Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.GetAddr(), esResourceInfo.GetAddr(), esCb.GetAddr(), esSpecificInfo_addr, esHandle.GetAddr()); @@ -771,7 +772,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t esF if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) { - cellDmux.Error("cellDmuxEnableEs: invalid specific info addr (0x%x)", esSpecificInfo_addr); + cellDmux->Error("cellDmuxEnableEs: invalid specific info addr (0x%x)", esSpecificInfo_addr); return CELL_DMUX_ERROR_FATAL; } @@ -792,11 +793,11 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t esF esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2, esCb->cbEsMsgFunc, esCb->cbArg_addr, esSpecificInfo_addr); - u32 id = cellDmux.GetNewId(es); + u32 id = cellDmux->GetNewId(es); es->id = id; esHandle = id; - cellDmux.Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter(0x%x, 0x%x, 0x%x, 0x%x), cb=0x%x(arg=0x%x), spec=0x%x): id = %d", + cellDmux->Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter(0x%x, 0x%x, 0x%x, 0x%x), cb=0x%x(arg=0x%x), spec=0x%x): id = %d", demuxerHandle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, (u32)esCb->cbEsMsgFunc, es->cbArg, es->spec, id); DemuxerTask task(dmuxEnableEs); @@ -809,7 +810,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t esF int cellDmuxDisableEs(u32 esHandle) { - cellDmux.Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle); + cellDmux->Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle); ElementaryStream* es; if (!Emu.GetIdManager().GetIDData(esHandle, es)) @@ -827,7 +828,7 @@ int cellDmuxDisableEs(u32 esHandle) int cellDmuxResetEs(u32 esHandle) { - cellDmux.Log("cellDmuxResetEs(esHandle=0x%x)", esHandle); + cellDmux->Log("cellDmuxResetEs(esHandle=0x%x)", esHandle); ElementaryStream* es; if (!Emu.GetIdManager().GetIDData(esHandle, es)) @@ -845,7 +846,7 @@ int cellDmuxResetEs(u32 esHandle) int cellDmuxGetAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr) { - cellDmux.Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + cellDmux->Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", esHandle, auInfo_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr()); ElementaryStream* es; @@ -873,7 +874,7 @@ int cellDmuxGetAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr) int cellDmuxPeekAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr) { - cellDmux.Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + cellDmux->Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", esHandle, auInfo_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr()); ElementaryStream* es; @@ -901,7 +902,7 @@ int cellDmuxPeekAu(u32 esHandle, mem32_t auInfo_ptr, mem32_t auSpecificInfo_ptr) int cellDmuxGetAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_ptr) { - cellDmux.Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + cellDmux->Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", esHandle, auInfoEx_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr()); ElementaryStream* es; @@ -929,7 +930,7 @@ int cellDmuxGetAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_p int cellDmuxPeekAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_ptr) { - cellDmux.Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", + cellDmux->Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", esHandle, auInfoEx_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr()); ElementaryStream* es; @@ -957,7 +958,7 @@ int cellDmuxPeekAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_ int cellDmuxReleaseAu(u32 esHandle) { - cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); + cellDmux->Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); ElementaryStream* es; if (!Emu.GetIdManager().GetIDData(esHandle, es)) @@ -974,7 +975,7 @@ int cellDmuxReleaseAu(u32 esHandle) int cellDmuxFlushEs(u32 esHandle) { - cellDmux.Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle); + cellDmux->Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle); ElementaryStream* es; if (!Emu.GetIdManager().GetIDData(esHandle, es)) @@ -992,24 +993,24 @@ int cellDmuxFlushEs(u32 esHandle) void cellDmux_init() { - cellDmux.AddFunc(0xa2d4189b, cellDmuxQueryAttr); - cellDmux.AddFunc(0x3f76e3cd, cellDmuxQueryAttr2); - cellDmux.AddFunc(0x68492de9, cellDmuxOpen); - cellDmux.AddFunc(0xf6c23560, cellDmuxOpenEx); - cellDmux.AddFunc(0x11bc3a6c, cellDmuxOpen2); - cellDmux.AddFunc(0x8c692521, cellDmuxClose); - cellDmux.AddFunc(0x04e7499f, cellDmuxSetStream); - cellDmux.AddFunc(0x5d345de9, cellDmuxResetStream); - cellDmux.AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone); - cellDmux.AddFunc(0x02170d1a, cellDmuxQueryEsAttr); - cellDmux.AddFunc(0x52911bcf, cellDmuxQueryEsAttr2); - cellDmux.AddFunc(0x7b56dc3f, cellDmuxEnableEs); - cellDmux.AddFunc(0x05371c8d, cellDmuxDisableEs); - cellDmux.AddFunc(0x21d424f0, cellDmuxResetEs); - cellDmux.AddFunc(0x42c716b5, cellDmuxGetAu); - cellDmux.AddFunc(0x2750c5e0, cellDmuxPeekAu); - cellDmux.AddFunc(0x2c9a5857, cellDmuxGetAuEx); - cellDmux.AddFunc(0x002e8da2, cellDmuxPeekAuEx); - cellDmux.AddFunc(0x24ea6474, cellDmuxReleaseAu); - cellDmux.AddFunc(0xebb3b2bd, cellDmuxFlushEs); + cellDmux->AddFunc(0xa2d4189b, cellDmuxQueryAttr); + cellDmux->AddFunc(0x3f76e3cd, cellDmuxQueryAttr2); + cellDmux->AddFunc(0x68492de9, cellDmuxOpen); + cellDmux->AddFunc(0xf6c23560, cellDmuxOpenEx); + cellDmux->AddFunc(0x11bc3a6c, cellDmuxOpen2); + cellDmux->AddFunc(0x8c692521, cellDmuxClose); + cellDmux->AddFunc(0x04e7499f, cellDmuxSetStream); + cellDmux->AddFunc(0x5d345de9, cellDmuxResetStream); + cellDmux->AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone); + cellDmux->AddFunc(0x02170d1a, cellDmuxQueryEsAttr); + cellDmux->AddFunc(0x52911bcf, cellDmuxQueryEsAttr2); + cellDmux->AddFunc(0x7b56dc3f, cellDmuxEnableEs); + cellDmux->AddFunc(0x05371c8d, cellDmuxDisableEs); + cellDmux->AddFunc(0x21d424f0, cellDmuxResetEs); + cellDmux->AddFunc(0x42c716b5, cellDmuxGetAu); + cellDmux->AddFunc(0x2750c5e0, cellDmuxPeekAu); + cellDmux->AddFunc(0x2c9a5857, cellDmuxGetAuEx); + cellDmux->AddFunc(0x002e8da2, cellDmuxPeekAuEx); + cellDmux->AddFunc(0x24ea6474, cellDmuxReleaseAu); + cellDmux->AddFunc(0xebb3b2bd, cellDmuxFlushEs); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp index 9d6bb5eb5e..a64a9a914f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFiber.cpp @@ -360,4 +360,4 @@ void cellFiber_init() cellFiber.AddFunc(0xea6dc1ad, cellFiberPpuUtilWorkerControlCheckFlags); cellFiber.AddFunc(0xf2ccad4f, cellFiberPpuUtilWorkerControlInitializeWithAttribute); } -#endif +#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index 460a4d9ef6..a20329da74 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -10,10 +10,11 @@ #include "cellFont.h" #include "stblib/stb_truetype.h" -void cellFont_init(); -void cellFont_load(); -void cellFont_unload(); -Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload); +//void cellFont_init(); +//void cellFont_load(); +//void cellFont_unload(); +//Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload); +Module *cellFont = nullptr; // Font Set Types enum @@ -238,7 +239,7 @@ CCellFontInternal* s_fontInternalInstance = nullptr; // Functions int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t config) { - cellFont.Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=0x%x)", revisionFlags, config.GetAddr()); + cellFont->Warning("cellFontInitializeWithRevision(revisionFlags=0x%llx, config=0x%x)", revisionFlags, config.GetAddr()); if (s_fontInternalInstance->m_bInitialized) return CELL_FONT_ERROR_ALREADY_INITIALIZED; @@ -249,7 +250,7 @@ int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t if (config->FileCache.size < 24) return CELL_FONT_ERROR_INVALID_PARAMETER; if (config->flags != 0) - cellFont.Warning("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); + cellFont->Warning("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); s_fontInternalInstance->m_buffer_addr = config->FileCache.buffer_addr; s_fontInternalInstance->m_buffer_size = config->FileCache.size; @@ -267,7 +268,7 @@ int cellFontGetRevisionFlags(mem64_t revisionFlags) int cellFontInit(mem_ptr_t config) { - cellFont.Log("cellFontInit(config=0x%x)", config.GetAddr()); + cellFont->Log("cellFontInit(config=0x%x)", config.GetAddr()); MemoryAllocator revisionFlags = 0; cellFontGetRevisionFlags(revisionFlags.GetAddr()); @@ -276,7 +277,7 @@ int cellFontInit(mem_ptr_t config) int cellFontEnd() { - cellFont.Log("cellFontEnd()"); + cellFont->Log("cellFontEnd()"); if (!s_fontInternalInstance->m_bInitialized) return CELL_FONT_ERROR_UNINITIALIZED; @@ -287,14 +288,14 @@ int cellFontEnd() s32 cellFontSetFontsetOpenMode(u32 openMode) { - cellFont.Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode); + cellFont->Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode); UNIMPLEMENTED_FUNC(cellFont); return CELL_FONT_OK; } int cellFontOpenFontMemory(mem_ptr_t library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, mem_ptr_t font) { - cellFont.Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)", + cellFont->Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)", library.GetAddr(), fontAddr, fontSize, subNum, uniqueId, font.GetAddr()); if (!s_fontInternalInstance->m_bInitialized) @@ -316,7 +317,7 @@ int cellFontOpenFontMemory(mem_ptr_t library, u32 fontAddr, u32 int cellFontOpenFontFile(mem_ptr_t library, mem8_ptr_t fontPath, u32 subNum, s32 uniqueId, mem_ptr_t font) { std::string fp(fontPath.GetString()); - cellFont.Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)", + cellFont->Warning("cellFontOpenFontFile(library_addr=0x%x, fontPath=\"%s\", subNum=%d, uniqueId=%d, font_addr=0x%x)", library.GetAddr(), fp.c_str(), subNum, uniqueId, font.GetAddr()); vfsFile f(fp); @@ -333,7 +334,7 @@ int cellFontOpenFontFile(mem_ptr_t library, mem8_ptr_t fontPath int cellFontOpenFontset(mem_ptr_t library, mem_ptr_t fontType, mem_ptr_t font) { - cellFont.Log("cellFontOpenFontset(library_addr=0x%x, fontType_addr=0x%x, font_addr=0x%x)", + cellFont->Log("cellFontOpenFontset(library_addr=0x%x, fontType_addr=0x%x, font_addr=0x%x)", library.GetAddr(), fontType.GetAddr(), font.GetAddr()); if (!library.IsGood() || !fontType.IsGood() || !font.IsGood()) @@ -341,7 +342,7 @@ int cellFontOpenFontset(mem_ptr_t library, mem_ptr_tm_bInitialized) return CELL_FONT_ERROR_UNINITIALIZED; if (fontType->map != CELL_FONT_MAP_UNICODE) - cellFont.Warning("cellFontOpenFontset: Only Unicode is supported"); + cellFont->Warning("cellFontOpenFontset: Only Unicode is supported"); std::string file; switch((u32)fontType->type) @@ -400,12 +401,12 @@ int cellFontOpenFontset(mem_ptr_t library, mem_ptr_ttype = %d not supported yet. RD-R-LATIN.TTF will be used instead.", fontType->type); + cellFont->Warning("cellFontOpenFontset: fontType->type = %d not supported yet. RD-R-LATIN.TTF will be used instead.", fontType->type); file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; default: - cellFont.Warning("cellFontOpenFontset: fontType->type = %d not supported.", fontType->type); + cellFont->Warning("cellFontOpenFontset: fontType->type = %d not supported.", fontType->type); return CELL_FONT_ERROR_NO_SUPPORT_FONTSET; } @@ -419,7 +420,7 @@ int cellFontOpenFontset(mem_ptr_t library, mem_ptr_t openedFont, mem_ptr_t font) { - cellFont.Warning("cellFontOpenFontInstance(openedFont=0x%x, font=0x%x)", openedFont.GetAddr(), font.GetAddr()); + cellFont->Warning("cellFontOpenFontInstance(openedFont=0x%x, font=0x%x)", openedFont.GetAddr(), font.GetAddr()); if (!openedFont.IsGood() || !font.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -436,14 +437,14 @@ int cellFontOpenFontInstance(mem_ptr_t openedFont, mem_ptr_t s32 cellFontSetFontOpenMode(u32 openMode) { - cellFont.Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode); + cellFont->Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode); UNIMPLEMENTED_FUNC(cellFont); return CELL_FONT_OK; } int cellFontCreateRenderer(mem_ptr_t library, mem_ptr_t config, mem_ptr_t Renderer) { - cellFont.Warning("cellFontCreateRenderer(library_addr=0x%x, config_addr=0x%x, Renderer_addr=0x%x)", + cellFont->Warning("cellFontCreateRenderer(library_addr=0x%x, config_addr=0x%x, Renderer_addr=0x%x)", library.GetAddr(), config.GetAddr(), Renderer.GetAddr()); if (!library.IsGood() || !config.IsGood() || !Renderer.IsGood()) @@ -458,7 +459,7 @@ int cellFontCreateRenderer(mem_ptr_t library, mem_ptr_t surface, u32 buffer_addr, s32 bufferWidthByte, s32 pixelSizeByte, s32 w, s32 h) { - cellFont.Warning("cellFontRenderSurfaceInit(surface_addr=0x%x, buffer_addr=0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)", + cellFont->Warning("cellFontRenderSurfaceInit(surface_addr=0x%x, buffer_addr=0x%x, bufferWidthByte=%d, pixelSizeByte=%d, w=%d, h=%d)", surface.GetAddr(), buffer_addr, bufferWidthByte, pixelSizeByte, w, h); surface->buffer_addr = buffer_addr; @@ -473,7 +474,7 @@ void cellFontRenderSurfaceInit(mem_ptr_t surface, u32 buf void cellFontRenderSurfaceSetScissor(mem_ptr_t surface, s32 x0, s32 y0, s32 w, s32 h) { - cellFont.Warning("cellFontRenderSurfaceSetScissor(surface_addr=0x%x, x0=%d, y0=%d, w=%d, h=%d)", + cellFont->Warning("cellFontRenderSurfaceSetScissor(surface_addr=0x%x, x0=%d, y0=%d, w=%d, h=%d)", surface.GetAddr(), x0, y0, w, h); surface->Scissor.x0 = x0; @@ -486,7 +487,7 @@ int cellFontSetScalePixel(mem_ptr_t font, float w, float h) { w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments h = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments - cellFont.Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h); + cellFont->Log("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h); if (!font.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -498,7 +499,7 @@ int cellFontSetScalePixel(mem_ptr_t font, float w, float h) int cellFontGetHorizontalLayout(mem_ptr_t font, mem_ptr_t layout) { - cellFont.Log("cellFontGetHorizontalLayout(font_addr=0x%x, layout_addr=0x%x)", + cellFont->Log("cellFontGetHorizontalLayout(font_addr=0x%x, layout_addr=0x%x)", font.GetAddr(), layout.GetAddr()); if (!font.IsGood() || !layout.IsGood()) @@ -516,7 +517,7 @@ int cellFontGetHorizontalLayout(mem_ptr_t font, mem_ptr_t font, mem_ptr_t renderer) { - cellFont.Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)", + cellFont->Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)", font.GetAddr(), renderer.GetAddr()); if (!font.IsGood() || !renderer.IsGood()) @@ -530,7 +531,7 @@ int cellFontBindRenderer(mem_ptr_t font, mem_ptr_t r int cellFontUnbindRenderer(mem_ptr_t font) { - cellFont.Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr()); + cellFont->Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr()); if (!font.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -551,7 +552,7 @@ int cellFontSetupRenderScalePixel(mem_ptr_t font, float w, float h) { w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments h = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments - cellFont.Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h); + cellFont->Log("cellFontSetupRenderScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h); if (!font.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -564,7 +565,7 @@ int cellFontSetupRenderScalePixel(mem_ptr_t font, float w, float h) int cellFontGetRenderCharGlyphMetrics(mem_ptr_t font, u32 code, mem_ptr_t metrics) { - cellFont.Log("cellFontGetRenderCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", + cellFont->Log("cellFontGetRenderCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x)", font.GetAddr(), code, metrics.GetAddr()); if (!font.IsGood() || !metrics.IsGood()) @@ -580,7 +581,7 @@ int cellFontRenderCharGlyphImage(mem_ptr_t font, u32 code, mem_ptr_tLog("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)", font.GetAddr(), code, surface.GetAddr(), x, y, metrics.GetAddr(), transInfo.GetAddr()); if (!font.IsGood() || !surface.IsGood() || !metrics.IsGood() || !transInfo.IsGood()) @@ -627,7 +628,7 @@ int cellFontEndLibrary() int cellFontSetEffectSlant(mem_ptr_t font, float slantParam) { slantParam = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments - cellFont.Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.GetAddr(), slantParam); + cellFont->Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.GetAddr(), slantParam); if (!font.IsGood() || slantParam < -1.0 || slantParam > 1.0) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -638,7 +639,7 @@ int cellFontSetEffectSlant(mem_ptr_t font, float slantParam) int cellFontGetEffectSlant(mem_ptr_t font, mem32_t slantParam) { - cellFont.Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.GetAddr(), slantParam.GetAddr()); + cellFont->Warning("cellFontSetEffectSlant(font_addr=0x%x, slantParam_addr=0x%x)", font.GetAddr(), slantParam.GetAddr()); if (!font.IsGood() || !slantParam.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -649,7 +650,7 @@ int cellFontGetEffectSlant(mem_ptr_t font, mem32_t slantParam) int cellFontGetFontIdCode(mem_ptr_t font, u32 code, mem32_t fontId, mem32_t fontCode) { - cellFont.Log("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x", + cellFont->Log("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x", font.GetAddr(), code, fontId.GetAddr(), fontCode.GetAddr()); if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used @@ -661,7 +662,7 @@ int cellFontGetFontIdCode(mem_ptr_t font, u32 code, mem32_t fontId, me int cellFontCloseFont(mem_ptr_t font) { - cellFont.Warning("cellFontCloseFont(font_addr=0x%x)", font.GetAddr()); + cellFont->Warning("cellFontCloseFont(font_addr=0x%x)", font.GetAddr()); if (!font.IsGood()) return CELL_FONT_ERROR_INVALID_PARAMETER; @@ -676,7 +677,7 @@ int cellFontCloseFont(mem_ptr_t font) int cellFontGetCharGlyphMetrics(mem_ptr_t font, u32 code, mem_ptr_t metrics) { - cellFont.Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x", + cellFont->Log("cellFontGetCharGlyphMetrics(font_addr=0x%x, code=0x%x, metrics_addr=0x%x", font.GetAddr(), code, metrics.GetAddr()); if (!font.IsGood() || metrics.IsGood()) @@ -816,7 +817,7 @@ int cellFontDeleteGlyph() int cellFontExtend(u32 a1, u32 a2, u32 a3) { - cellFont.Warning("cellFontExtend(a1=0x%x, a2=0x%x, a3=0x%x)", a1, a2, a3); + cellFont->Warning("cellFontExtend(a1=0x%x, a2=0x%x, a3=0x%x)", a1, a2, a3); //In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something) if (a1 == 0xcfe00000) { @@ -854,56 +855,56 @@ int cellFontGetCharGlyphMetricsVertical() void cellFont_init() { - cellFont.AddFunc(0x25c107e6, cellFontInit); - cellFont.AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode); - cellFont.AddFunc(0x6cfada83, cellFontSetFontOpenMode); - cellFont.AddFunc(0x042e74e3, cellFontCreateRenderer); - cellFont.AddFunc(0x1387c45c, cellFontGetHorizontalLayout); - cellFont.AddFunc(0x21ebb248, cellFontDestroyRenderer); - cellFont.AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel); - cellFont.AddFunc(0x29329541, cellFontOpenFontInstance); - cellFont.AddFunc(0x297f0e93, cellFontSetScalePixel); - cellFont.AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics); - cellFont.AddFunc(0x40d40544, cellFontEndLibrary); - cellFont.AddFunc(0x66a23100, cellFontBindRenderer); - cellFont.AddFunc(0x7ab47f7e, cellFontEnd); - cellFont.AddFunc(0x8657c8f5, cellFontSetEffectSlant); - cellFont.AddFunc(0xe16e679a, cellFontGetEffectSlant); - cellFont.AddFunc(0x88be4799, cellFontRenderCharGlyphImage); - cellFont.AddFunc(0x90b9465e, cellFontRenderSurfaceInit); - cellFont.AddFunc(0x98ac5524, cellFontGetFontIdCode); - cellFont.AddFunc(0xa885cc9b, cellFontOpenFontset); - cellFont.AddFunc(0xb276f1f6, cellFontCloseFont); - cellFont.AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor); - cellFont.AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics); - cellFont.AddFunc(0xf03dcc29, cellFontInitializeWithRevision); - cellFont.AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA); - cellFont.AddFunc(0x073fa321, cellFontOpenFontsetOnMemory); - cellFont.AddFunc(0x0a7306a4, cellFontOpenFontFile); - cellFont.AddFunc(0x16322df1, cellFontGraphicsSetScalePixel); - cellFont.AddFunc(0x2388186c, cellFontGraphicsGetScalePixel); - cellFont.AddFunc(0x25253fe4, cellFontSetEffectWeight); - cellFont.AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph); - cellFont.AddFunc(0x698897f8, cellFontGetVerticalLayout); - cellFont.AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical); - cellFont.AddFunc(0x70f3e728, cellFontSetScalePoint); - cellFont.AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant); - cellFont.AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA); - cellFont.AddFunc(0x87bd650f, cellFontGraphicsSetDrawType); - cellFont.AddFunc(0x8a35c887, cellFontEndGraphics); - cellFont.AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext); - cellFont.AddFunc(0x9e19072b, cellFontOpenFontMemory); - cellFont.AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight); - cellFont.AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance); - cellFont.AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize); - cellFont.AddFunc(0xc17259de, cellFontGenerateCharGlyph); - cellFont.AddFunc(0xd62f5d76, cellFontDeleteGlyph); - cellFont.AddFunc(0xdee0836c, cellFontExtend); - cellFont.AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical); - cellFont.AddFunc(0xfb3341ba, cellFontSetResolutionDpi); - cellFont.AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical); - cellFont.AddFunc(0xf16379fa, cellFontUnbindRenderer); - cellFont.AddFunc(0xb015a84e, cellFontGetRevisionFlags); + cellFont->AddFunc(0x25c107e6, cellFontInit); + cellFont->AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode); + cellFont->AddFunc(0x6cfada83, cellFontSetFontOpenMode); + cellFont->AddFunc(0x042e74e3, cellFontCreateRenderer); + cellFont->AddFunc(0x1387c45c, cellFontGetHorizontalLayout); + cellFont->AddFunc(0x21ebb248, cellFontDestroyRenderer); + cellFont->AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel); + cellFont->AddFunc(0x29329541, cellFontOpenFontInstance); + cellFont->AddFunc(0x297f0e93, cellFontSetScalePixel); + cellFont->AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics); + cellFont->AddFunc(0x40d40544, cellFontEndLibrary); + cellFont->AddFunc(0x66a23100, cellFontBindRenderer); + cellFont->AddFunc(0x7ab47f7e, cellFontEnd); + cellFont->AddFunc(0x8657c8f5, cellFontSetEffectSlant); + cellFont->AddFunc(0xe16e679a, cellFontGetEffectSlant); + cellFont->AddFunc(0x88be4799, cellFontRenderCharGlyphImage); + cellFont->AddFunc(0x90b9465e, cellFontRenderSurfaceInit); + cellFont->AddFunc(0x98ac5524, cellFontGetFontIdCode); + cellFont->AddFunc(0xa885cc9b, cellFontOpenFontset); + cellFont->AddFunc(0xb276f1f6, cellFontCloseFont); + cellFont->AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor); + cellFont->AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics); + cellFont->AddFunc(0xf03dcc29, cellFontInitializeWithRevision); + cellFont->AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA); + cellFont->AddFunc(0x073fa321, cellFontOpenFontsetOnMemory); + cellFont->AddFunc(0x0a7306a4, cellFontOpenFontFile); + cellFont->AddFunc(0x16322df1, cellFontGraphicsSetScalePixel); + cellFont->AddFunc(0x2388186c, cellFontGraphicsGetScalePixel); + cellFont->AddFunc(0x25253fe4, cellFontSetEffectWeight); + cellFont->AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph); + cellFont->AddFunc(0x698897f8, cellFontGetVerticalLayout); + cellFont->AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical); + cellFont->AddFunc(0x70f3e728, cellFontSetScalePoint); + cellFont->AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant); + cellFont->AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA); + cellFont->AddFunc(0x87bd650f, cellFontGraphicsSetDrawType); + cellFont->AddFunc(0x8a35c887, cellFontEndGraphics); + cellFont->AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext); + cellFont->AddFunc(0x9e19072b, cellFontOpenFontMemory); + cellFont->AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight); + cellFont->AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance); + cellFont->AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize); + cellFont->AddFunc(0xc17259de, cellFontGenerateCharGlyph); + cellFont->AddFunc(0xd62f5d76, cellFontDeleteGlyph); + cellFont->AddFunc(0xdee0836c, cellFontExtend); + cellFont->AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical); + cellFont->AddFunc(0xfb3341ba, cellFontSetResolutionDpi); + cellFont->AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical); + cellFont->AddFunc(0xf16379fa, cellFontUnbindRenderer); + cellFont->AddFunc(0xb015a84e, cellFontGetRevisionFlags); } void cellFont_load() diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp index b421af3ac2..317a318242 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp @@ -8,10 +8,11 @@ #include "Emu/SysCalls/SysCalls.h" #include "cellFont.h" -void cellFontFT_init(); -void cellFontFT_load(); -void cellFontFT_unload(); -Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload); +//void cellFontFT_init(); +//void cellFontFT_load(); +//void cellFontFT_unload(); +//Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload); +extern Module *cellFontFT = nullptr; struct CellFontLibraryConfigFT { @@ -44,7 +45,7 @@ CCellFontFTInternal* s_fontFtInternalInstance = nullptr; int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t config, u32 lib_addr_addr) { - cellFontFT.Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config_addr=0x%x, lib_addr_addr=0x%x", + cellFontFT->Warning("cellFontInitLibraryFreeTypeWithRevision(revisionFlags=0x%llx, config_addr=0x%x, lib_addr_addr=0x%x", revisionFlags, config.GetAddr(), lib_addr_addr); if (!config.IsGood() || !Memory.IsGoodAddr(lib_addr_addr)) @@ -71,9 +72,9 @@ int cellFontFTGetInitializedRevisionFlags() void cellFontFT_init() { - cellFontFT.AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision); - cellFontFT.AddFunc(0xec89a187, cellFontFTGetRevisionFlags); - cellFontFT.AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags); + cellFontFT->AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision); + cellFontFT->AddFunc(0xec89a187, cellFontFTGetRevisionFlags); + cellFontFT->AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags); } void cellFontFT_load() diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 470d2dc66a..200894c3b9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -10,8 +10,9 @@ #include "Loader/PSF.h" -void cellGame_init(); -Module cellGame(0x003e, cellGame_init); +//void cellGame_init(); +//Module cellGame(0x003e, cellGame_init); +extern Module *cellGame = nullptr; // Return Codes enum @@ -118,12 +119,12 @@ struct CellGameContentSize int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t size, mem_list_ptr_t dirName) { - cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", + cellGame->Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)", type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr()); if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood()) { - cellGame.Warning("cellGameBootCheck returns CELL_GAME_ERROR_PARAM. As a result size->hddFreeSizeKB may be 0."); + cellGame->Warning("cellGameBootCheck returns CELL_GAME_ERROR_PARAM. As a result size->hddFreeSizeKB may be 0."); return CELL_GAME_ERROR_PARAM; } @@ -159,7 +160,7 @@ int cellGameDataCheck() int cellGameContentPermit(mem_list_ptr_t contentInfoPath, mem_list_ptr_t usrdirPath) { - cellGame.Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)", + cellGame->Warning("cellGameContentPermit(contentInfoPath_addr=0x%x, usrdirPath_addr=0x%x)", contentInfoPath.GetAddr(), usrdirPath.GetAddr()); if (!contentInfoPath.IsGood() || !usrdirPath.IsGood()) @@ -192,7 +193,7 @@ int cellGameDeleteGameData() int cellGameGetParamInt(u32 id, mem32_t value) { - cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr()); + cellGame->Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr()); if(!value.IsGood()) return CELL_GAME_ERROR_PARAM; @@ -218,7 +219,7 @@ int cellGameGetParamInt(u32 id, mem32_t value) int cellGameGetParamString(u32 id, u32 buf_addr, u32 bufsize) { - cellGame.Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf_addr, bufsize); + cellGame->Warning("cellGameGetParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf_addr, bufsize); if(!Memory.IsGoodAddr(buf_addr)) return CELL_GAME_ERROR_PARAM; @@ -293,7 +294,7 @@ int cellGameGetLocalWebContentPath() int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) { - cellGame.Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr); + cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr); if (Memory.IsGoodAddr(dirName_addr)) return CELL_GAME_ERROR_PARAM; @@ -313,7 +314,7 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName); - wxMessageBox(fmt::FromUTF8(errorMsg), wxGetApp().GetAppName(), wxICON_ERROR | wxOK); + rMessageBox(errorMsg, rGetApp().GetAppName(), rICON_ERROR | rOK); return CELL_OK; } @@ -333,25 +334,25 @@ void cellGame_init() { // (TODO: Disc Exchange functions missing) - cellGame.AddFunc(0xf52639ea, cellGameBootCheck); - cellGame.AddFunc(0xce4374f6, cellGamePatchCheck); - cellGame.AddFunc(0xdb9819f3, cellGameDataCheck); - cellGame.AddFunc(0x70acec67, cellGameContentPermit); + cellGame->AddFunc(0xf52639ea, cellGameBootCheck); + cellGame->AddFunc(0xce4374f6, cellGamePatchCheck); + cellGame->AddFunc(0xdb9819f3, cellGameDataCheck); + cellGame->AddFunc(0x70acec67, cellGameContentPermit); - cellGame.AddFunc(0x42a2e133, cellGameCreateGameData); - cellGame.AddFunc(0xb367c6e3, cellGameDeleteGameData); + cellGame->AddFunc(0x42a2e133, cellGameCreateGameData); + cellGame->AddFunc(0xb367c6e3, cellGameDeleteGameData); - cellGame.AddFunc(0xb7a45caf, cellGameGetParamInt); - //cellGame.AddFunc(, cellGameSetParamInt); - cellGame.AddFunc(0x3a5d726a, cellGameGetParamString); - cellGame.AddFunc(0xdaa5cd20, cellGameSetParamString); - cellGame.AddFunc(0xef9d42d5, cellGameGetSizeKB); - cellGame.AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath); - cellGame.AddFunc(0xa80bf223, cellGameGetLocalWebContentPath); + cellGame->AddFunc(0xb7a45caf, cellGameGetParamInt); + //cellGame->AddFunc(, cellGameSetParamInt); + cellGame->AddFunc(0x3a5d726a, cellGameGetParamString); + cellGame->AddFunc(0xdaa5cd20, cellGameSetParamString); + cellGame->AddFunc(0xef9d42d5, cellGameGetSizeKB); + cellGame->AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath); + cellGame->AddFunc(0xa80bf223, cellGameGetLocalWebContentPath); - cellGame.AddFunc(0xb0a1f8c6, cellGameContentErrorDialog); + cellGame->AddFunc(0xb0a1f8c6, cellGameContentErrorDialog); - cellGame.AddFunc(0xd24e3928, cellGameThemeInstall); - cellGame.AddFunc(0x87406734, cellGameThemeInstallFromBuffer); - //cellGame.AddFunc(, CellGameThemeInstallCallback); + cellGame->AddFunc(0xd24e3928, cellGameThemeInstall); + cellGame->AddFunc(0x87406734, cellGameThemeInstallFromBuffer); + //cellGame->AddFunc(, CellGameThemeInstallCallback); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index a7911d5d0f..d42a0b7ca7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -8,10 +8,11 @@ #include "Emu/SysCalls/SysCalls.h" #include "Emu/GS/GCM.h" -void cellGcmSys_init(); -void cellGcmSys_load(); -void cellGcmSys_unload(); -Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload); +//void cellGcmSys_init(); +//void cellGcmSys_load(); +//void cellGcmSys_unload(); +//Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload); +extern Module *cellGcmSys = nullptr; u32 local_size = 0; u32 local_addr = 0; @@ -67,17 +68,17 @@ u32 map_offset_pos = 0; u32 cellGcmGetLabelAddress(u8 index) { - cellGcmSys.Log("cellGcmGetLabelAddress(index=%d)", index); + cellGcmSys->Log("cellGcmGetLabelAddress(index=%d)", index); return Memory.RSXCMDMem.GetStartAddr() + 0x10 * index; } u32 cellGcmGetReportDataAddressLocation(u32 index, u32 location) { - cellGcmSys.Warning("cellGcmGetReportDataAddressLocation(index=%d, location=%d)", index, location); + cellGcmSys->Warning("cellGcmGetReportDataAddressLocation(index=%d, location=%d)", index, location); if (location == CELL_GCM_LOCATION_LOCAL) { if (index >= 2048) { - cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); return 0; } return Memory.RSXFBMem.GetStartAddr() + index * 0x10; @@ -85,23 +86,23 @@ u32 cellGcmGetReportDataAddressLocation(u32 index, u32 location) if (location == CELL_GCM_LOCATION_MAIN) { if (index >= 1024*1024) { - cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); + cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); return 0; } // TODO: It seems m_report_main_addr is not initialized return Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10; } - cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location); + cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location); return 0; } u64 cellGcmGetTimeStamp(u32 index) { - cellGcmSys.Log("cellGcmGetTimeStamp(index=%d)", index); + cellGcmSys->Log("cellGcmGetTimeStamp(index=%d)", index); if (index >= 2048) { - cellGcmSys.Error("cellGcmGetTimeStamp: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetTimeStamp: Wrong local index (%d)", index); return 0; } return Memory.Read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); @@ -121,10 +122,10 @@ int cellGcmGetNotifyDataAddress() u32 cellGcmGetReport(u32 type, u32 index) { - cellGcmSys.Warning("cellGcmGetReport(type=%d, index=%d)", type, index); + cellGcmSys->Warning("cellGcmGetReport(type=%d, index=%d)", type, index); if (index >= 2048) { - cellGcmSys.Error("cellGcmGetReport: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetReport: Wrong local index (%d)", index); return 0; } // TODO: What does the argument type do? @@ -133,10 +134,10 @@ u32 cellGcmGetReport(u32 type, u32 index) u32 cellGcmGetReportDataAddress(u32 index) { - cellGcmSys.Warning("cellGcmGetReportDataAddress(index=%d)", index); + cellGcmSys->Warning("cellGcmGetReportDataAddress(index=%d)", index); if (index >= 2048) { - cellGcmSys.Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); return 0; } return Memory.RSXFBMem.GetStartAddr() + index * 0x10; @@ -144,11 +145,11 @@ u32 cellGcmGetReportDataAddress(u32 index) u32 cellGcmGetReportDataLocation(u32 index, u32 location) { - cellGcmSys.Warning("cellGcmGetReportDataLocation(index=%d, location=%d)", index, location); + cellGcmSys->Warning("cellGcmGetReportDataLocation(index=%d, location=%d)", index, location); if (location == CELL_GCM_LOCATION_LOCAL) { if (index >= 2048) { - cellGcmSys.Error("cellGcmGetReportDataLocation: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetReportDataLocation: Wrong local index (%d)", index); return 0; } return Memory.Read32(Memory.RSXFBMem.GetStartAddr() + index * 0x10 + 0x8); @@ -156,24 +157,24 @@ u32 cellGcmGetReportDataLocation(u32 index, u32 location) if (location == CELL_GCM_LOCATION_MAIN) { if (index >= 1024*1024) { - cellGcmSys.Error("cellGcmGetReportDataLocation: Wrong main index (%d)", index); + cellGcmSys->Error("cellGcmGetReportDataLocation: Wrong main index (%d)", index); return 0; } // TODO: It seems m_report_main_addr is not initialized return Memory.Read32(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10 + 0x8); } - cellGcmSys.Error("cellGcmGetReportDataLocation: Wrong location (%d)", location); + cellGcmSys->Error("cellGcmGetReportDataLocation: Wrong location (%d)", location); return 0; } u64 cellGcmGetTimeStampLocation(u32 index, u32 location) { - cellGcmSys.Warning("cellGcmGetTimeStampLocation(index=%d, location=%d)", index, location); + cellGcmSys->Warning("cellGcmGetTimeStampLocation(index=%d, location=%d)", index, location); if (location == CELL_GCM_LOCATION_LOCAL) { if (index >= 2048) { - cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); + cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); return 0; } return Memory.Read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); @@ -181,14 +182,14 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location) if (location == CELL_GCM_LOCATION_MAIN) { if (index >= 1024*1024) { - cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index); + cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index); return 0; } // TODO: It seems m_report_main_addr is not initialized return Memory.Read64(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10); } - cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong location (%d)", location); + cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong location (%d)", location); return 0; } @@ -198,32 +199,32 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location) u32 cellGcmGetControlRegister() { - cellGcmSys.Log("cellGcmGetControlRegister()"); + cellGcmSys->Log("cellGcmGetControlRegister()"); return gcm_info.control_addr; } u32 cellGcmGetDefaultCommandWordSize() { - cellGcmSys.Log("cellGcmGetDefaultCommandWordSize()"); + cellGcmSys->Log("cellGcmGetDefaultCommandWordSize()"); return 0x400; } u32 cellGcmGetDefaultSegmentWordSize() { - cellGcmSys.Log("cellGcmGetDefaultSegmentWordSize()"); + cellGcmSys->Log("cellGcmGetDefaultSegmentWordSize()"); return 0x100; } int cellGcmInitDefaultFifoMode(s32 mode) { - cellGcmSys.Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode); + cellGcmSys->Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode); return CELL_OK; } int cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize) { - cellGcmSys.Warning("cellGcmSetDefaultFifoSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); + cellGcmSys->Warning("cellGcmSetDefaultFifoSize(bufferSize=0x%x, segmentSize=0x%x)", bufferSize, segmentSize); return CELL_OK; } @@ -233,11 +234,11 @@ int cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize) int cellGcmBindTile(u8 index) { - cellGcmSys.Warning("cellGcmBindTile(index=%d)", index); + cellGcmSys->Warning("cellGcmBindTile(index=%d)", index); if (index >= RSXThread::m_tiles_count) { - cellGcmSys.Error("cellGcmBindTile : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmBindTile : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -249,11 +250,11 @@ int cellGcmBindTile(u8 index) int cellGcmBindZcull(u8 index) { - cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index); + cellGcmSys->Warning("cellGcmBindZcull(index=%d)", index); if (index >= RSXThread::m_zculls_count) { - cellGcmSys.Error("cellGcmBindZcull : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmBindZcull : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -265,11 +266,11 @@ int cellGcmBindZcull(u8 index) int cellGcmGetConfiguration(mem_ptr_t config) { - cellGcmSys.Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr()); + cellGcmSys->Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr()); if (!config.IsGood()) { - cellGcmSys.Error("cellGcmGetConfiguration : CELL_EFAULT"); + cellGcmSys->Error("cellGcmGetConfiguration : CELL_EFAULT"); return CELL_EFAULT; } @@ -280,15 +281,14 @@ int cellGcmGetConfiguration(mem_ptr_t config) int cellGcmGetFlipStatus() { - cellGcmSys.Log("cellGcmGetFlipStatus()"); + cellGcmSys->Log("cellGcmGetFlipStatus()"); return Emu.GetGSManager().GetRender().m_flip_status; } u32 cellGcmGetTiledPitchSize(u32 size) { - cellGcmSys.Warning("cellGcmGetTiledPitchSize(size=%d)", size); - + cellGcmSys->Warning("cellGcmGetTiledPitchSize(size=%d)", size); // TODO: return size; @@ -296,10 +296,10 @@ u32 cellGcmGetTiledPitchSize(u32 size) int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) { - cellGcmSys.Warning("cellGcmInit(context_addr=0x%x,cmdSize=0x%x,ioSize=0x%x,ioAddress=0x%x)", context_addr, cmdSize, ioSize, ioAddress); + cellGcmSys->Warning("cellGcmInit(context_addr=0x%x,cmdSize=0x%x,ioSize=0x%x,ioAddress=0x%x)", context_addr, cmdSize, ioSize, ioAddress); - if(!cellGcmSys.IsLoaded()) - cellGcmSys.Load(); + if(!cellGcmSys->IsLoaded()) + cellGcmSys->Load(); if(!local_size && !local_addr) { @@ -308,14 +308,14 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) Memory.RSXFBMem.AllocAlign(local_size); } - cellGcmSys.Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size); + cellGcmSys->Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size); InitOffsetTable(); Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x10000000/*256MB*/));//TODO: implement allocateAdressSpace in memoryBase if(cellGcmMapEaIoAddress(ioAddress, 0, ioSize) != CELL_OK) { Memory.MemoryBlocks.pop_back(); - cellGcmSys.Error("cellGcmInit : CELL_GCM_ERROR_FAILURE"); + cellGcmSys->Error("cellGcmInit : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -363,7 +363,7 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) int cellGcmResetFlipStatus() { - cellGcmSys.Log("cellGcmResetFlipStatus()"); + cellGcmSys->Log("cellGcmResetFlipStatus()"); Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING; @@ -372,7 +372,7 @@ int cellGcmResetFlipStatus() int cellGcmSetDebugOutputLevel(int level) { - cellGcmSys.Warning("cellGcmSetDebugOutputLevel(level=%d)", level); + cellGcmSys->Warning("cellGcmSetDebugOutputLevel(level=%d)", level); switch (level) { @@ -390,11 +390,11 @@ int cellGcmSetDebugOutputLevel(int level) int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height) { - cellGcmSys.Log("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height); + cellGcmSys->Log("cellGcmSetDisplayBuffer(id=0x%x,offset=0x%x,pitch=%d,width=%d,height=%d)", id, offset, width ? pitch / width : pitch, width, height); if (id > 7) { - cellGcmSys.Error("cellGcmSetDisplayBuffer : CELL_EINVAL"); + cellGcmSys->Error("cellGcmSetDisplayBuffer : CELL_EINVAL"); return CELL_EINVAL; } @@ -415,7 +415,7 @@ int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height int cellGcmSetFlip(mem_ptr_t ctxt, u32 id) { - cellGcmSys.Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id); + cellGcmSys->Log("cellGcmSetFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id); int res = cellGcmSetPrepareFlip(ctxt, id); return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; @@ -423,11 +423,11 @@ int cellGcmSetFlip(mem_ptr_t ctxt, u32 id) int cellGcmSetFlipHandler(u32 handler_addr) { - cellGcmSys.Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler_addr); + cellGcmSys->Warning("cellGcmSetFlipHandler(handler_addr=%d)", handler_addr); if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr)) { - cellGcmSys.Error("cellGcmSetFlipHandler : CELL_EFAULT"); + cellGcmSys->Error("cellGcmSetFlipHandler : CELL_EFAULT"); return CELL_EFAULT; } @@ -437,7 +437,7 @@ int cellGcmSetFlipHandler(u32 handler_addr) int cellGcmSetFlipMode(u32 mode) { - cellGcmSys.Warning("cellGcmSetFlipMode(mode=%d)", mode); + cellGcmSys->Warning("cellGcmSetFlipMode(mode=%d)", mode); switch (mode) { @@ -456,18 +456,18 @@ int cellGcmSetFlipMode(u32 mode) void cellGcmSetFlipStatus() { - cellGcmSys.Warning("cellGcmSetFlipStatus()"); + cellGcmSys->Warning("cellGcmSetFlipStatus()"); Emu.GetGSManager().GetRender().m_flip_status = 0; } int cellGcmSetPrepareFlip(mem_ptr_t ctxt, u32 id) { - cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id); + cellGcmSys->Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id); if(id >= 8) { - cellGcmSys.Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); + cellGcmSys->Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -508,7 +508,7 @@ int cellGcmSetPrepareFlip(mem_ptr_t ctxt, u32 id) int cellGcmSetSecondVFrequency(u32 freq) { - cellGcmSys.Warning("cellGcmSetSecondVFrequency(level=%d)", freq); + cellGcmSys->Warning("cellGcmSetSecondVFrequency(level=%d)", freq); switch (freq) { @@ -526,30 +526,30 @@ int cellGcmSetSecondVFrequency(u32 freq) int cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) { - cellGcmSys.Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", + cellGcmSys->Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", index, location, offset, size, pitch, comp, base, bank); if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) { - cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } if (offset & 0xffff || size & 0xffff || pitch & 0xf) { - cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ALIGNMENT; } if (location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) { - cellGcmSys.Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys->Error("cellGcmSetTileInfo : CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ENUM; } if (comp) { - cellGcmSys.Error("cellGcmSetTileInfo: bad compression mode! (%d)", comp); + cellGcmSys->Error("cellGcmSetTileInfo: bad compression mode! (%d)", comp); } auto& tile = Emu.GetGSManager().GetRender().m_tiles[index]; @@ -567,7 +567,7 @@ int cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u u32 cellGcmSetUserHandler(u32 handler) { - cellGcmSys.Warning("cellGcmSetUserHandler(handler=0x%x)", handler); + cellGcmSys->Warning("cellGcmSetUserHandler(handler=0x%x)", handler); return handler; } @@ -579,7 +579,7 @@ int cellGcmSetVBlankHandler() int cellGcmSetWaitFlip(mem_ptr_t ctxt) { - cellGcmSys.Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr()); + cellGcmSys->Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr()); GSLockCurrent lock(GS_LOCK_WAIT_FLIP); return CELL_OK; @@ -587,12 +587,12 @@ int cellGcmSetWaitFlip(mem_ptr_t ctxt) int cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, u32 zFormat, u32 aaFormat, u32 zCullDir, u32 zCullFormat, u32 sFunc, u32 sRef, u32 sMask) { - cellGcmSys.Warning("TODO: cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", + cellGcmSys->Warning("TODO: cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)", index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask); if (index >= RSXThread::m_zculls_count) { - cellGcmSys.Error("cellGcmSetZcull : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmSetZcull : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -616,11 +616,11 @@ int cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart, int cellGcmUnbindTile(u8 index) { - cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index); + cellGcmSys->Warning("cellGcmUnbindTile(index=%d)", index); if (index >= RSXThread::m_tiles_count) { - cellGcmSys.Error("cellGcmUnbindTile : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmUnbindTile : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -632,11 +632,11 @@ int cellGcmUnbindTile(u8 index) int cellGcmUnbindZcull(u8 index) { - cellGcmSys.Warning("cellGcmUnbindZcull(index=%d)", index); + cellGcmSys->Warning("cellGcmUnbindZcull(index=%d)", index); if (index >= 8) { - cellGcmSys.Error("cellGcmUnbindZcull : CELL_EINVAL"); + cellGcmSys->Error("cellGcmUnbindZcull : CELL_EINVAL"); return CELL_EINVAL; } @@ -648,29 +648,29 @@ int cellGcmUnbindZcull(u8 index) u32 cellGcmGetTileInfo() { - cellGcmSys.Warning("cellGcmGetTileInfo()"); + cellGcmSys->Warning("cellGcmGetTileInfo()"); return Emu.GetGSManager().GetRender().m_tiles_addr; } u32 cellGcmGetZcullInfo() { - cellGcmSys.Warning("cellGcmGetZcullInfo()"); + cellGcmSys->Warning("cellGcmGetZcullInfo()"); return Emu.GetGSManager().GetRender().m_zculls_addr; } u32 cellGcmGetDisplayInfo() { - cellGcmSys.Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().m_gcm_buffers_addr); + cellGcmSys->Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().m_gcm_buffers_addr); return Emu.GetGSManager().GetRender().m_gcm_buffers_addr; } int cellGcmGetCurrentDisplayBufferId(u32 id_addr) { - cellGcmSys.Warning("cellGcmGetCurrentDisplayBufferId(id_addr=0x%x)", id_addr); + cellGcmSys->Warning("cellGcmGetCurrentDisplayBufferId(id_addr=0x%x)", id_addr); if (!Memory.IsGoodAddr(id_addr)) { - cellGcmSys.Error("cellGcmGetCurrentDisplayBufferId : CELL_EFAULT"); + cellGcmSys->Error("cellGcmGetCurrentDisplayBufferId : CELL_EFAULT"); return CELL_EFAULT; } @@ -780,7 +780,7 @@ void InitOffsetTable() int32_t cellGcmAddressToOffset(u64 address, mem32_t offset) { - cellGcmSys.Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.GetAddr()); + cellGcmSys->Log("cellGcmAddressToOffset(address=0x%x,offset_addr=0x%x)", address, offset.GetAddr()); if (address >= 0xD0000000/*not on main memory or local*/) return CELL_GCM_ERROR_FAILURE; @@ -838,7 +838,7 @@ int32_t cellGcmIoOffsetToAddress(u32 ioOffset, u64 address) int32_t cellGcmMapEaIoAddress(const u32 ea, const u32 io, const u32 size) { - cellGcmSys.Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size); + cellGcmSys->Warning("cellGcmMapEaIoAddress(ea=0x%x, io=0x%x, size=0x%x)", ea, io, size); if ((ea & 0xFFFFF) || (io & 0xFFFFF) || (size & 0xFFFFF)) return CELL_GCM_ERROR_FAILURE; @@ -854,7 +854,7 @@ int32_t cellGcmMapEaIoAddress(const u32 ea, const u32 io, const u32 size) } else { - cellGcmSys.Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE"); + cellGcmSys->Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -863,7 +863,7 @@ int32_t cellGcmMapEaIoAddress(const u32 ea, const u32 io, const u32 size) int32_t cellGcmMapEaIoAddressWithFlags(const u32 ea, const u32 io, const u32 size, const u32 flags) { - cellGcmSys.Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags); + cellGcmSys->Warning("cellGcmMapEaIoAddressWithFlags(ea=0x%x, io=0x%x, size=0x%x, flags=0x%x)", ea, io, size, flags); return cellGcmMapEaIoAddress(ea, io, size); // TODO: strict ordering } @@ -879,7 +879,7 @@ int32_t cellGcmMapLocalMemory(u64 address, u64 size) } else { - cellGcmSys.Error("RSX local memory already mapped"); + cellGcmSys->Error("RSX local memory already mapped"); return CELL_GCM_ERROR_FAILURE; } @@ -888,7 +888,7 @@ int32_t cellGcmMapLocalMemory(u64 address, u64 size) int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset) { - cellGcmSys.Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.GetAddr()); + cellGcmSys->Warning("cellGcmMapMainMemory(ea=0x%x,size=0x%x,offset_addr=0x%x)", ea, size, offset.GetAddr()); u64 io; @@ -911,7 +911,7 @@ int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset) } else { - cellGcmSys.Error("cellGcmMapMainMemory : CELL_GCM_ERROR_NO_IO_PAGE_TABLE"); + cellGcmSys->Error("cellGcmMapMainMemory : CELL_GCM_ERROR_NO_IO_PAGE_TABLE"); return CELL_GCM_ERROR_NO_IO_PAGE_TABLE; } @@ -924,13 +924,13 @@ int32_t cellGcmReserveIoMapSize(const u32 size) { if (size & 0xFFFFF) { - cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ALIGNMENT; } if (size > cellGcmGetMaxIoMapSize()) { - cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -955,7 +955,7 @@ int32_t cellGcmUnmapEaIoAddress(u64 ea) } else { - cellGcmSys.Error("cellGcmUnmapEaIoAddress : CELL_GCM_ERROR_FAILURE"); + cellGcmSys->Error("cellGcmUnmapEaIoAddress : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -979,7 +979,7 @@ int32_t cellGcmUnmapIoAddress(u64 io) } else { - cellGcmSys.Error("cellGcmUnmapIoAddress : CELL_GCM_ERROR_FAILURE"); + cellGcmSys->Error("cellGcmUnmapIoAddress : CELL_GCM_ERROR_FAILURE"); return CELL_GCM_ERROR_FAILURE; } @@ -991,13 +991,13 @@ int32_t cellGcmUnreserveIoMapSize(u32 size) if (size & 0xFFFFF) { - cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ALIGNMENT; } if (size > Memory.RSXIOMem.GetReservedAmount()) { - cellGcmSys.Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmReserveIoMapSize : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } @@ -1051,7 +1051,7 @@ int cellGcmSetCursorImageOffset(u32 offset) void cellGcmSetDefaultCommandBuffer() { - cellGcmSys.Warning("cellGcmSetDefaultCommandBuffer()"); + cellGcmSys->Warning("cellGcmSetDefaultCommandBuffer()"); Memory.Write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr); } @@ -1066,7 +1066,7 @@ int cellGcmSetFlipCommand(u32 ctx, u32 id) s64 cellGcmFunc15() { - cellGcmSys.Error("cellGcmFunc15()"); + cellGcmSys->Error("cellGcmFunc15()"); return 0; } @@ -1079,31 +1079,31 @@ int cellGcmSetFlipCommandWithWaitLabel(u32 ctx, u32 id, u32 label_index, u32 lab int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 comp, u16 base, u8 bank) { - cellGcmSys.Warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", + cellGcmSys->Warning("cellGcmSetTile(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)", index, location, offset, size, pitch, comp, base, bank); // Copied form cellGcmSetTileInfo if(index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) { - cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_VALUE"); + cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_VALUE"); return CELL_GCM_ERROR_INVALID_VALUE; } if(offset & 0xffff || size & 0xffff || pitch & 0xf) { - cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ALIGNMENT"); + cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ALIGNMENT"); return CELL_GCM_ERROR_INVALID_ALIGNMENT; } if(location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) { - cellGcmSys.Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ENUM"); + cellGcmSys->Error("cellGcmSetTile : CELL_GCM_ERROR_INVALID_ENUM"); return CELL_GCM_ERROR_INVALID_ENUM; } if(comp) { - cellGcmSys.Error("cellGcmSetTile: bad comp! (%d)", comp); + cellGcmSys->Error("cellGcmSetTile: bad comp! (%d)", comp); } auto& tile = Emu.GetGSManager().GetRender().m_tiles[index]; @@ -1124,105 +1124,105 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co void cellGcmSys_init() { // Data Retrieval - cellGcmSys.AddFunc(0xc8f3bd09, cellGcmGetCurrentField); - cellGcmSys.AddFunc(0xf80196c1, cellGcmGetLabelAddress); - cellGcmSys.AddFunc(0x21cee035, cellGcmGetNotifyDataAddress); - cellGcmSys.AddFunc(0x99d397ac, cellGcmGetReport); - cellGcmSys.AddFunc(0x9a0159af, cellGcmGetReportDataAddress); - cellGcmSys.AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation); - cellGcmSys.AddFunc(0xa6b180ac, cellGcmGetReportDataLocation); - cellGcmSys.AddFunc(0x5a41c10f, cellGcmGetTimeStamp); - cellGcmSys.AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation); + cellGcmSys->AddFunc(0xc8f3bd09, cellGcmGetCurrentField); + cellGcmSys->AddFunc(0xf80196c1, cellGcmGetLabelAddress); + cellGcmSys->AddFunc(0x21cee035, cellGcmGetNotifyDataAddress); + cellGcmSys->AddFunc(0x99d397ac, cellGcmGetReport); + cellGcmSys->AddFunc(0x9a0159af, cellGcmGetReportDataAddress); + cellGcmSys->AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation); + cellGcmSys->AddFunc(0xa6b180ac, cellGcmGetReportDataLocation); + cellGcmSys->AddFunc(0x5a41c10f, cellGcmGetTimeStamp); + cellGcmSys->AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation); // Command Buffer Control - cellGcmSys.AddFunc(0xa547adde, cellGcmGetControlRegister); - cellGcmSys.AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize); - cellGcmSys.AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize); - cellGcmSys.AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode); - cellGcmSys.AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize); - //cellGcmSys.AddFunc(, cellGcmReserveMethodSize); - //cellGcmSys.AddFunc(, cellGcmResetDefaultCommandBuffer); - //cellGcmSys.AddFunc(, cellGcmSetupContextData); - //cellGcmSys.AddFunc(, cellGcmCallbackForSnc); - //cellGcmSys.AddFunc(, cellGcmFinish); - //cellGcmSys.AddFunc(, cellGcmFlush); + cellGcmSys->AddFunc(0xa547adde, cellGcmGetControlRegister); + cellGcmSys->AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize); + cellGcmSys->AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize); + cellGcmSys->AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode); + cellGcmSys->AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize); + //cellGcmSys->AddFunc(, cellGcmReserveMethodSize); + //cellGcmSys->AddFunc(, cellGcmResetDefaultCommandBuffer); + //cellGcmSys->AddFunc(, cellGcmSetupContextData); + //cellGcmSys->AddFunc(, cellGcmCallbackForSnc); + //cellGcmSys->AddFunc(, cellGcmFinish); + //cellGcmSys->AddFunc(, cellGcmFlush); // Hardware Resource Management - cellGcmSys.AddFunc(0x4524cccd, cellGcmBindTile); - cellGcmSys.AddFunc(0x9dc04436, cellGcmBindZcull); - cellGcmSys.AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError); - cellGcmSys.AddFunc(0xe315a0b2, cellGcmGetConfiguration); - cellGcmSys.AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex); - cellGcmSys.AddFunc(0x72a577ce, cellGcmGetFlipStatus); - cellGcmSys.AddFunc(0x63387071, cellGcmgetLastFlipTime); - cellGcmSys.AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime); - cellGcmSys.AddFunc(0x055bd74d, cellGcmGetTiledPitchSize); - cellGcmSys.AddFunc(0x723bbc7e, cellGcmGetVBlankCount); - cellGcmSys.AddFunc(0x15bae46b, cellGcmInit); - cellGcmSys.AddFunc(0xfce9e764, cellGcmInitSystemMode); - cellGcmSys.AddFunc(0xb2e761d4, cellGcmResetFlipStatus); - cellGcmSys.AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel); - cellGcmSys.AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer); - cellGcmSys.AddFunc(0xdc09357e, cellGcmSetFlip); - cellGcmSys.AddFunc(0xa41ef7e8, cellGcmSetFlipHandler); - cellGcmSys.AddFunc(0xacee8542, cellGcmSetFlipImmediate); - cellGcmSys.AddFunc(0x4ae8d215, cellGcmSetFlipMode); - cellGcmSys.AddFunc(0xa47c09ff, cellGcmSetFlipStatus); - cellGcmSys.AddFunc(0xd01b570d, cellGcmSetGraphicsHandler); - cellGcmSys.AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip); - cellGcmSys.AddFunc(0x0a862772, cellGcmSetQueueHandler); - cellGcmSys.AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency); - cellGcmSys.AddFunc(0xdc494430, cellGcmSetSecondVHandler); - cellGcmSys.AddFunc(0xbd100dbc, cellGcmSetTileInfo); - cellGcmSys.AddFunc(0x06edea9e, cellGcmSetUserHandler); - cellGcmSys.AddFunc(0xffe0160e, cellGcmSetVBlankFrequency); - cellGcmSys.AddFunc(0xa91b0402, cellGcmSetVBlankHandler); - cellGcmSys.AddFunc(0x983fb9aa, cellGcmSetWaitFlip); - cellGcmSys.AddFunc(0xd34a420d, cellGcmSetZcull); - cellGcmSys.AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress); - cellGcmSys.AddFunc(0xd9b7653e, cellGcmUnbindTile); - cellGcmSys.AddFunc(0xa75640e8, cellGcmUnbindZcull); - cellGcmSys.AddFunc(0x657571f7, cellGcmGetTileInfo); - cellGcmSys.AddFunc(0xd9a0a879, cellGcmGetZcullInfo); - cellGcmSys.AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo); - cellGcmSys.AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId); - cellGcmSys.AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile); - //cellGcmSys.AddFunc(, cellGcmSetFlipWithWaitLabel); + cellGcmSys->AddFunc(0x4524cccd, cellGcmBindTile); + cellGcmSys->AddFunc(0x9dc04436, cellGcmBindZcull); + cellGcmSys->AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError); + cellGcmSys->AddFunc(0xe315a0b2, cellGcmGetConfiguration); + cellGcmSys->AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex); + cellGcmSys->AddFunc(0x72a577ce, cellGcmGetFlipStatus); + cellGcmSys->AddFunc(0x63387071, cellGcmgetLastFlipTime); + cellGcmSys->AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime); + cellGcmSys->AddFunc(0x055bd74d, cellGcmGetTiledPitchSize); + cellGcmSys->AddFunc(0x723bbc7e, cellGcmGetVBlankCount); + cellGcmSys->AddFunc(0x15bae46b, cellGcmInit); + cellGcmSys->AddFunc(0xfce9e764, cellGcmInitSystemMode); + cellGcmSys->AddFunc(0xb2e761d4, cellGcmResetFlipStatus); + cellGcmSys->AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel); + cellGcmSys->AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer); + cellGcmSys->AddFunc(0xdc09357e, cellGcmSetFlip); + cellGcmSys->AddFunc(0xa41ef7e8, cellGcmSetFlipHandler); + cellGcmSys->AddFunc(0xacee8542, cellGcmSetFlipImmediate); + cellGcmSys->AddFunc(0x4ae8d215, cellGcmSetFlipMode); + cellGcmSys->AddFunc(0xa47c09ff, cellGcmSetFlipStatus); + cellGcmSys->AddFunc(0xd01b570d, cellGcmSetGraphicsHandler); + cellGcmSys->AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip); + cellGcmSys->AddFunc(0x0a862772, cellGcmSetQueueHandler); + cellGcmSys->AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency); + cellGcmSys->AddFunc(0xdc494430, cellGcmSetSecondVHandler); + cellGcmSys->AddFunc(0xbd100dbc, cellGcmSetTileInfo); + cellGcmSys->AddFunc(0x06edea9e, cellGcmSetUserHandler); + cellGcmSys->AddFunc(0xffe0160e, cellGcmSetVBlankFrequency); + cellGcmSys->AddFunc(0xa91b0402, cellGcmSetVBlankHandler); + cellGcmSys->AddFunc(0x983fb9aa, cellGcmSetWaitFlip); + cellGcmSys->AddFunc(0xd34a420d, cellGcmSetZcull); + cellGcmSys->AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress); + cellGcmSys->AddFunc(0xd9b7653e, cellGcmUnbindTile); + cellGcmSys->AddFunc(0xa75640e8, cellGcmUnbindZcull); + cellGcmSys->AddFunc(0x657571f7, cellGcmGetTileInfo); + cellGcmSys->AddFunc(0xd9a0a879, cellGcmGetZcullInfo); + cellGcmSys->AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo); + cellGcmSys->AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId); + cellGcmSys->AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile); + //cellGcmSys->AddFunc(, cellGcmSetFlipWithWaitLabel); // Memory Mapping - cellGcmSys.AddFunc(0x21ac3697, cellGcmAddressToOffset); - cellGcmSys.AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize); - cellGcmSys.AddFunc(0x2922aed0, cellGcmGetOffsetTable); - cellGcmSys.AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress); - cellGcmSys.AddFunc(0x63441cb4, cellGcmMapEaIoAddress); - cellGcmSys.AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags); - cellGcmSys.AddFunc(0xdb769b32, cellGcmMapLocalMemory); - cellGcmSys.AddFunc(0xa114ec67, cellGcmMapMainMemory); - cellGcmSys.AddFunc(0xa7ede268, cellGcmReserveIoMapSize); - cellGcmSys.AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress); - cellGcmSys.AddFunc(0xdb23e867, cellGcmUnmapIoAddress); - cellGcmSys.AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize); + cellGcmSys->AddFunc(0x21ac3697, cellGcmAddressToOffset); + cellGcmSys->AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize); + cellGcmSys->AddFunc(0x2922aed0, cellGcmGetOffsetTable); + cellGcmSys->AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress); + cellGcmSys->AddFunc(0x63441cb4, cellGcmMapEaIoAddress); + cellGcmSys->AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags); + cellGcmSys->AddFunc(0xdb769b32, cellGcmMapLocalMemory); + cellGcmSys->AddFunc(0xa114ec67, cellGcmMapMainMemory); + cellGcmSys->AddFunc(0xa7ede268, cellGcmReserveIoMapSize); + cellGcmSys->AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress); + cellGcmSys->AddFunc(0xdb23e867, cellGcmUnmapIoAddress); + cellGcmSys->AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize); // Cursor - cellGcmSys.AddFunc(0x107bf3a1, cellGcmInitCursor); - cellGcmSys.AddFunc(0xc47d0812, cellGcmSetCursorEnable); - cellGcmSys.AddFunc(0x69c6cc82, cellGcmSetCursorDisable); - cellGcmSys.AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset); - cellGcmSys.AddFunc(0x1a0de550, cellGcmSetCursorPosition); - cellGcmSys.AddFunc(0xbd2fa0a7, cellGcmUpdateCursor); + cellGcmSys->AddFunc(0x107bf3a1, cellGcmInitCursor); + cellGcmSys->AddFunc(0xc47d0812, cellGcmSetCursorEnable); + cellGcmSys->AddFunc(0x69c6cc82, cellGcmSetCursorDisable); + cellGcmSys->AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset); + cellGcmSys->AddFunc(0x1a0de550, cellGcmSetCursorPosition); + cellGcmSys->AddFunc(0xbd2fa0a7, cellGcmUpdateCursor); // Functions for Maintaining Compatibility - cellGcmSys.AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer); - //cellGcmSys.AddFunc(, cellGcmGetCurrentBuffer); - //cellGcmSys.AddFunc(, cellGcmSetCurrentBuffer); - //cellGcmSys.AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize); - //cellGcmSys.AddFunc(, cellGcmSetUserCallback); + cellGcmSys->AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer); + //cellGcmSys->AddFunc(, cellGcmGetCurrentBuffer); + //cellGcmSys->AddFunc(, cellGcmSetCurrentBuffer); + //cellGcmSys->AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize); + //cellGcmSys->AddFunc(, cellGcmSetUserCallback); // Other - cellGcmSys.AddFunc(0x21397818, cellGcmSetFlipCommand); - cellGcmSys.AddFunc(0x3a33c1fd, cellGcmFunc15); - cellGcmSys.AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel); - cellGcmSys.AddFunc(0xd0b1d189, cellGcmSetTile); + cellGcmSys->AddFunc(0x21397818, cellGcmSetFlipCommand); + cellGcmSys->AddFunc(0x3a33c1fd, cellGcmFunc15); + cellGcmSys->AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel); + cellGcmSys->AddFunc(0xd0b1d189, cellGcmSetTile); } void cellGcmSys_load() diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index a557e05673..5133ce51c4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -283,4 +283,4 @@ void cellGem_init() cellGem.AddFunc(0x1f6328d8, cellGemWriteExternalPort); } -#endif +#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index cc83f278e5..bdfdc72dbb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -11,8 +11,9 @@ #include "stblib/stb_image.h" #include "stblib/stb_image.c" // (TODO: Should we put this elsewhere?) -void cellGifDec_init(); -Module cellGifDec(0xf010, cellGifDec_init); +//void cellGifDec_init(); +//Module cellGifDec(0xf010, cellGifDec_init); +extern Module *cellGifDec = nullptr; int cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) { @@ -73,7 +74,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_tfileSize = sb->st_size; // Get CellFsStat.st_size // From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. - subHandle = cellGifDec.GetNewId(current_subHandle); + subHandle = cellGifDec->GetNewId(current_subHandle); return CELL_OK; } @@ -84,7 +85,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_tCheckId(subHandle, subHandle_data)) return CELL_GIFDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -125,7 +126,7 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tCheckId(subHandle, subHandle_data)) return CELL_GIFDEC_ERROR_FATAL; CellGifDecInfo& current_info = subHandle_data->info; @@ -157,7 +158,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP; CellGifDecSubHandle* subHandle_data; - if(!cellGifDec.CheckId(subHandle, subHandle_data)) + if(!cellGifDec->CheckId(subHandle, subHandle_data)) return CELL_GIFDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -206,7 +207,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m int cellGifDecClose(u32 mainHandle, u32 subHandle) { CellGifDecSubHandle* subHandle_data; - if(!cellGifDec.CheckId(subHandle, subHandle_data)) + if(!cellGifDec->CheckId(subHandle, subHandle_data)) return CELL_GIFDEC_ERROR_FATAL; cellFsClose(subHandle_data->fd); @@ -223,17 +224,17 @@ int cellGifDecDestroy(u32 mainHandle) void cellGifDec_init() { - cellGifDec.AddFunc(0xb60d42a5, cellGifDecCreate); - cellGifDec.AddFunc(0x4711cb7f, cellGifDecExtCreate); - cellGifDec.AddFunc(0x75745079, cellGifDecOpen); - cellGifDec.AddFunc(0xf0da95de, cellGifDecReadHeader); - cellGifDec.AddFunc(0x41a90dc4, cellGifDecSetParameter); - cellGifDec.AddFunc(0x44b1bc61, cellGifDecDecodeData); - cellGifDec.AddFunc(0x116a7da9, cellGifDecClose); - cellGifDec.AddFunc(0xe74b2cb1, cellGifDecDestroy); + cellGifDec->AddFunc(0xb60d42a5, cellGifDecCreate); + cellGifDec->AddFunc(0x4711cb7f, cellGifDecExtCreate); + cellGifDec->AddFunc(0x75745079, cellGifDecOpen); + cellGifDec->AddFunc(0xf0da95de, cellGifDecReadHeader); + cellGifDec->AddFunc(0x41a90dc4, cellGifDecSetParameter); + cellGifDec->AddFunc(0x44b1bc61, cellGifDecDecodeData); + cellGifDec->AddFunc(0x116a7da9, cellGifDecClose); + cellGifDec->AddFunc(0xe74b2cb1, cellGifDecDestroy); - /*cellGifDec.AddFunc(0x17fb83c1, cellGifDecExtOpen); - cellGifDec.AddFunc(0xe53f91f2, cellGifDecExtReadHeader); - cellGifDec.AddFunc(0x95cae771, cellGifDecExtSetParameter); - cellGifDec.AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/ + /*cellGifDec->AddFunc(0x17fb83c1, cellGifDecExtOpen); + cellGifDec->AddFunc(0xe53f91f2, cellGifDecExtReadHeader); + cellGifDec->AddFunc(0x95cae771, cellGifDecExtSetParameter); + cellGifDec->AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/ } diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index e2ba8b24df..74105d0c53 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -8,8 +8,9 @@ #include "cellJpgDec.h" #include "stblib/stb_image.h" -void cellJpgDec_init(); -Module cellJpgDec(0x000f, cellJpgDec_init); +//void cellJpgDec_init(); +//Module cellJpgDec(0x000f, cellJpgDec_init); +extern Module *cellJpgDec = nullptr; int cellJpgDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) { @@ -31,7 +32,7 @@ int cellJpgDecDestroy(u32 mainHandle) int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t src, mem_ptr_t openInfo) { - cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)", + cellJpgDec->Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)", mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo); if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood()) @@ -52,7 +53,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t s current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size // From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. - subHandle = cellJpgDec.GetNewId(current_subHandle); + subHandle = cellJpgDec->GetNewId(current_subHandle); return CELL_OK; } @@ -60,7 +61,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t s int cellJpgDecClose(u32 mainHandle, u32 subHandle) { CellJpgDecSubHandle* subHandle_data; - if(!cellJpgDec.CheckId(subHandle, subHandle_data)) + if(!cellJpgDec->CheckId(subHandle, subHandle_data)) return CELL_JPGDEC_ERROR_FATAL; cellFsClose(subHandle_data->fd); @@ -71,13 +72,13 @@ int cellJpgDecClose(u32 mainHandle, u32 subHandle) int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t info) { - cellJpgDec.Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr()); + cellJpgDec->Log("cellJpgDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr()); if (!info.IsGood()) return CELL_JPGDEC_ERROR_ARG; CellJpgDecSubHandle* subHandle_data; - if(!cellJpgDec.CheckId(subHandle, subHandle_data)) + if(!cellJpgDec->CheckId(subHandle, subHandle_data)) return CELL_JPGDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -137,7 +138,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP; CellJpgDecSubHandle* subHandle_data; - if(!cellJpgDec.CheckId(subHandle, subHandle_data)) + if(!cellJpgDec->CheckId(subHandle, subHandle_data)) return CELL_JPGDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -182,7 +183,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m case CELL_JPG_UPSAMPLE_ONLY: case CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA: case CELL_JPG_GRAYSCALE_TO_ALPHA_ARGB: - cellJpgDec.Error("cellJpgDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); + cellJpgDec->Error("cellJpgDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); break; default: @@ -203,7 +204,7 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tCheckId(subHandle, subHandle_data)) return CELL_JPGDEC_ERROR_FATAL; CellJpgDecInfo& current_info = subHandle_data->info; @@ -243,17 +244,17 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tAddFunc(0xa7978f59, cellJpgDecCreate); + cellJpgDec->AddFunc(0x8b300f66, cellJpgDecExtCreate); + cellJpgDec->AddFunc(0x976ca5c2, cellJpgDecOpen); + cellJpgDec->AddFunc(0x6d9ebccf, cellJpgDecReadHeader); + cellJpgDec->AddFunc(0xe08f3910, cellJpgDecSetParameter); + cellJpgDec->AddFunc(0xaf8bb012, cellJpgDecDecodeData); + cellJpgDec->AddFunc(0x9338a07a, cellJpgDecClose); + cellJpgDec->AddFunc(0xd8ea91f8, cellJpgDecDestroy); - /*cellJpgDec.AddFunc(0xa9f703e3, cellJpgDecExtOpen); - cellJpgDec.AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader); - cellJpgDec.AddFunc(0x65cbbb16, cellJpgDecExtSetParameter); - cellJpgDec.AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/ + /*cellJpgDec->AddFunc(0xa9f703e3, cellJpgDecExtOpen); + cellJpgDec->AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader); + cellJpgDec->AddFunc(0x65cbbb16, cellJpgDecExtSetParameter); + cellJpgDec->AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/ } diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index 641322fb6f..d09464ba5a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -11,8 +11,10 @@ #include #endif -void cellL10n_init(); -Module cellL10n(0x001e, cellL10n_init); +//void cellL10n_init(); +//Module cellL10n(0x001e, cellL10n_init); +Module *cellL10n = nullptr; + // L10nResult enum @@ -38,7 +40,7 @@ enum int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t utf8_len) { - cellL10n.Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)", + cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)", utf16.GetAddr(), utf16_len.GetAddr(), utf8.GetAddr(), utf8_len.GetAddr()); if (!utf16.IsGood() || !utf16_len.IsGood() || !utf8_len.IsGood()) @@ -65,11 +67,11 @@ int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t int jstrchk(mem8_ptr_t jstr) { if (!jstr.IsGood()) - cellL10n.Error("jstrchk(jstr_addr=0x%x): invalid address", jstr.GetAddr()); + cellL10n->Error("jstrchk(jstr_addr=0x%x): invalid address", jstr.GetAddr()); else if (jstr[0]) - cellL10n.Log("jstrchk(jstr_addr=0x%x): utf-8: [%s]", jstr.GetAddr(), Memory.ReadString(jstr.GetAddr()).c_str()); + cellL10n->Log("jstrchk(jstr_addr=0x%x): utf-8: [%s]", jstr.GetAddr(), Memory.ReadString(jstr.GetAddr()).c_str()); else - cellL10n.Log("jstrchk(jstr_addr=0x%x): empty string", jstr.GetAddr()); + cellL10n->Log("jstrchk(jstr_addr=0x%x): empty string", jstr.GetAddr()); return L10N_STR_UTF8; } @@ -78,169 +80,169 @@ void cellL10n_init() { // NOTE: I think this module should be LLE'd instead of implementing all its functions - // cellL10n.AddFunc(0x005200e6, UCS2toEUCJP); - // cellL10n.AddFunc(0x01b0cbf4, l10n_convert); - // cellL10n.AddFunc(0x0356038c, UCS2toUTF32); - // cellL10n.AddFunc(0x05028763, jis2kuten); - // cellL10n.AddFunc(0x058addc8, UTF8toGB18030); - // cellL10n.AddFunc(0x060ee3b2, JISstoUTF8s); - // cellL10n.AddFunc(0x07168a83, SjisZen2Han); - // cellL10n.AddFunc(0x0bc386c8, ToSjisLower); - // cellL10n.AddFunc(0x0bedf77d, UCS2toGB18030); - // cellL10n.AddFunc(0x0bf867e2, HZstoUCS2s); - // cellL10n.AddFunc(0x0ce278fd, UCS2stoHZs); - // cellL10n.AddFunc(0x0d90a48d, UCS2stoSJISs); - // cellL10n.AddFunc(0x0f624540, kuten2eucjp); - // cellL10n.AddFunc(0x14ee3649, sjis2jis); - // cellL10n.AddFunc(0x14f504b8, EUCKRstoUCS2s); - // cellL10n.AddFunc(0x16eaf5f1, UHCstoEUCKRs); - // cellL10n.AddFunc(0x1758053c, jis2sjis); - // cellL10n.AddFunc(0x1906ce6b, jstrnchk); - // cellL10n.AddFunc(0x1ac0d23d, L10nConvert); - // cellL10n.AddFunc(0x1ae2acee, EUCCNstoUTF8s); - // cellL10n.AddFunc(0x1cb1138f, GBKstoUCS2s); - // cellL10n.AddFunc(0x1da42d70, eucjphan2zen); - // cellL10n.AddFunc(0x1ec712e0, ToSjisHira); - // cellL10n.AddFunc(0x1fb50183, GBKtoUCS2); - // cellL10n.AddFunc(0x21948c03, eucjp2jis); - // cellL10n.AddFunc(0x21aa3045, UTF32stoUTF8s); - // cellL10n.AddFunc(0x24fd32a9, sjishan2zen); - // cellL10n.AddFunc(0x256b6861, UCS2toSBCS); - // cellL10n.AddFunc(0x262a5ae2, UTF8stoGBKs); - // cellL10n.AddFunc(0x28724522, UTF8toUCS2); - // cellL10n.AddFunc(0x2ad091c6, UCS2stoUTF8s); - // cellL10n.AddFunc(0x2b84030c, EUCKRstoUTF8s); - // cellL10n.AddFunc(0x2efa7294, UTF16stoUTF32s); - // cellL10n.AddFunc(0x2f9eb543, UTF8toEUCKR); - // cellL10n.AddFunc(0x317ab7c2, UTF16toUTF8); - // cellL10n.AddFunc(0x32689828, ARIBstoUTF8s); - // cellL10n.AddFunc(0x33435818, SJISstoUTF8s); - // cellL10n.AddFunc(0x33f8b35c, sjiszen2han); - // cellL10n.AddFunc(0x3968f176, ToEucJpLower); - // cellL10n.AddFunc(0x398a3dee, MSJIStoUTF8); - // cellL10n.AddFunc(0x3a20bc34, UCS2stoMSJISs); - // cellL10n.AddFunc(0x3dabd5a7, EUCJPtoUTF8); - // cellL10n.AddFunc(0x3df65b64, eucjp2sjis); - // cellL10n.AddFunc(0x408a622b, ToEucJpHira); - // cellL10n.AddFunc(0x41b4a5ae, UHCstoUCS2s); - // cellL10n.AddFunc(0x41ccf033, ToEucJpKata); - // cellL10n.AddFunc(0x42838145, HZstoUTF8s); - // cellL10n.AddFunc(0x4931b44e, UTF8toMSJIS); - // cellL10n.AddFunc(0x4b3bbacb, BIG5toUTF8); - // cellL10n.AddFunc(0x511d386b, EUCJPstoSJISs); - // cellL10n.AddFunc(0x52b7883f, UTF8stoBIG5s); - // cellL10n.AddFunc(0x53558b6b, UTF16stoUCS2s); - // cellL10n.AddFunc(0x53764725, UCS2stoGB18030s); - // cellL10n.AddFunc(0x53c71ac2, EUCJPtoSJIS); - // cellL10n.AddFunc(0x54f59807, EUCJPtoUCS2); - // cellL10n.AddFunc(0x55f6921c, UCS2stoGBKs); - // cellL10n.AddFunc(0x58246762, EUCKRtoUHC); - // cellL10n.AddFunc(0x596df41c, UCS2toSJIS); - // cellL10n.AddFunc(0x5a4ab223, MSJISstoUTF8s); - // cellL10n.AddFunc(0x5ac783dc, EUCJPstoUTF8s); - // cellL10n.AddFunc(0x5b684dfb, UCS2toBIG5); - // cellL10n.AddFunc(0x5cd29270, UTF8stoEUCKRs); - // cellL10n.AddFunc(0x5e1d9330, UHCstoUTF8s); - // cellL10n.AddFunc(0x60ffa0ec, GB18030stoUCS2s); - // cellL10n.AddFunc(0x6122e000, SJIStoUTF8); - // cellL10n.AddFunc(0x6169f205, JISstoSJISs); - // cellL10n.AddFunc(0x61fb9442, UTF8toUTF16); - // cellL10n.AddFunc(0x62b36bcf, UTF8stoMSJISs); - // cellL10n.AddFunc(0x63219199, EUCKRtoUTF8); - // cellL10n.AddFunc(0x638c2fc1, SjisHan2Zen); - // cellL10n.AddFunc(0x64a10ec8, UCS2toUTF16); - // cellL10n.AddFunc(0x65444204, UCS2toMSJIS); - // cellL10n.AddFunc(0x6621a82c, sjis2kuten); - // cellL10n.AddFunc(0x6a6f25d1, UCS2toUHC); - // cellL10n.AddFunc(0x6c62d879, UTF32toUCS2); - // cellL10n.AddFunc(0x6de4b508, ToSjisUpper); - // cellL10n.AddFunc(0x6e0705c4, UTF8toEUCJP); - // cellL10n.AddFunc(0x6e5906fd, UCS2stoEUCJPs); - // cellL10n.AddFunc(0x6fc530b3, UTF16toUCS2); - // cellL10n.AddFunc(0x714a9b4a, UCS2stoUTF16s); - // cellL10n.AddFunc(0x71804d64, UCS2stoEUCCNs); - // cellL10n.AddFunc(0x72632e53, SBCSstoUTF8s); - // cellL10n.AddFunc(0x73f2cd21, SJISstoJISs); - // cellL10n.AddFunc(0x74496718, SBCStoUTF8); - // cellL10n.AddFunc(0x74871fe0, UTF8toUTF32); - cellL10n.AddFunc(0x750c363d, jstrchk); - // cellL10n.AddFunc(0x7c5bde1c, UHCtoEUCKR); - // cellL10n.AddFunc(0x7c912bda, kuten2jis); - // cellL10n.AddFunc(0x7d07a1c2, UTF8toEUCCN); - // cellL10n.AddFunc(0x8171c1cc, EUCCNtoUTF8); - // cellL10n.AddFunc(0x82d5ecdf, EucJpZen2Han); - // cellL10n.AddFunc(0x8555fe15, UTF32stoUTF16s); - // cellL10n.AddFunc(0x860fc741, GBKtoUTF8); - // cellL10n.AddFunc(0x867f7b8b, ToEucJpUpper); - // cellL10n.AddFunc(0x88f8340b, UCS2stoJISs); - // cellL10n.AddFunc(0x89236c86, UTF8stoGB18030s); - // cellL10n.AddFunc(0x8a56f148, EUCKRstoUHCs); - // cellL10n.AddFunc(0x8ccdba38, UTF8stoUTF32s); - // cellL10n.AddFunc(0x8f472054, UTF8stoEUCCNs); - // cellL10n.AddFunc(0x90e9b5d2, EUCJPstoUCS2s); - // cellL10n.AddFunc(0x91a99765, UHCtoUCS2); - // cellL10n.AddFunc(0x931ff25a, L10nConvertStr); - // cellL10n.AddFunc(0x949bb14c, GBKstoUTF8s); - // cellL10n.AddFunc(0x9557ac9b, UTF8toUHC); - // cellL10n.AddFunc(0x9768b6d3, UTF32toUTF8); - // cellL10n.AddFunc(0x9874020d, sjis2eucjp); - // cellL10n.AddFunc(0x9a0e7d23, UCS2toEUCCN); - // cellL10n.AddFunc(0x9a13d6b8, UTF8stoUHCs); - // cellL10n.AddFunc(0x9a72059d, EUCKRtoUCS2); - // cellL10n.AddFunc(0x9b1210c6, UTF32toUTF16); - // cellL10n.AddFunc(0x9cd8135b, EUCCNstoUCS2s); - // cellL10n.AddFunc(0x9ce52809, SBCSstoUCS2s); - // cellL10n.AddFunc(0x9cf1ab77, UTF8stoJISs); - // cellL10n.AddFunc(0x9d14dc46, ToSjisKata); - // cellL10n.AddFunc(0x9dcde367, jis2eucjp); - // cellL10n.AddFunc(0x9ec52258, BIG5toUCS2); - // cellL10n.AddFunc(0xa0d463c0, UCS2toGBK); - // cellL10n.AddFunc(0xa19fb9de, UTF16toUTF32); - // cellL10n.AddFunc(0xa298cad2, l10n_convert_str); - // cellL10n.AddFunc(0xa34fa0eb, EUCJPstoJISs); - // cellL10n.AddFunc(0xa5146299, UTF8stoARIBs); - // cellL10n.AddFunc(0xa609f3e9, JISstoEUCJPs); - // cellL10n.AddFunc(0xa60ff5c9, EucJpHan2Zen); - // cellL10n.AddFunc(0xa963619c, isEucJpKigou); - // cellL10n.AddFunc(0xa9a76fb8, UCS2toUTF8); - // cellL10n.AddFunc(0xaf18d499, GB18030toUCS2); - // cellL10n.AddFunc(0xb3361be6, UHCtoUTF8); - // cellL10n.AddFunc(0xb6e45343, MSJIStoUCS2); - // cellL10n.AddFunc(0xb7cef4a6, UTF8toGBK); - // cellL10n.AddFunc(0xb7e08f7a, kuten2sjis); - // cellL10n.AddFunc(0xb9cf473d, UTF8toSBCS); - // cellL10n.AddFunc(0xbdd44ee3, SJIStoUCS2); - // cellL10n.AddFunc(0xbe42e661, eucjpzen2han); - // cellL10n.AddFunc(0xbe8d5485, UCS2stoARIBs); - // cellL10n.AddFunc(0xbefe3869, isSjisKigou); - // cellL10n.AddFunc(0xc62b758d, UTF8stoEUCJPs); - // cellL10n.AddFunc(0xc7bdcb4c, UCS2toEUCKR); - // cellL10n.AddFunc(0xc944fa56, SBCStoUCS2); - // cellL10n.AddFunc(0xc9b78f58, MSJISstoUCS2s); - // cellL10n.AddFunc(0xcc1633cc, l10n_get_converter); - // cellL10n.AddFunc(0xd02ef83d, GB18030stoUTF8s); - // cellL10n.AddFunc(0xd8721e2c, SJISstoEUCJPs); - // cellL10n.AddFunc(0xd8cb24cb, UTF32stoUCS2s); - // cellL10n.AddFunc(0xd990858b, BIG5stoUTF8s); - // cellL10n.AddFunc(0xd9fb1224, EUCCNtoUCS2); - // cellL10n.AddFunc(0xda67b37f, UTF8stoSBCSs); - // cellL10n.AddFunc(0xdc54886c, UCS2stoEUCKRs); - // cellL10n.AddFunc(0xdd5ebdeb, UTF8stoSJISs); - // cellL10n.AddFunc(0xdefa1c17, UTF8stoHZs); - // cellL10n.AddFunc(0xe2eabb32, eucjp2kuten); - // cellL10n.AddFunc(0xe6d9e234, UTF8toBIG5); - cellL10n.AddFunc(0xe6f5711b, UTF16stoUTF8s); - // cellL10n.AddFunc(0xe956dc64, JISstoUCS2s); - // cellL10n.AddFunc(0xeabc3d00, GB18030toUTF8); - // cellL10n.AddFunc(0xeb3dc670, UTF8toSJIS); - // cellL10n.AddFunc(0xeb41cc68, ARIBstoUCS2s); - // cellL10n.AddFunc(0xeb685b83, UCS2stoUTF32s); - // cellL10n.AddFunc(0xebae29c0, UCS2stoSBCSs); - // cellL10n.AddFunc(0xee6c6a39, UCS2stoBIG5s); - // cellL10n.AddFunc(0xf1dcfa71, UCS2stoUHCs); - // cellL10n.AddFunc(0xf439728e, SJIStoEUCJP); - // cellL10n.AddFunc(0xf7681b9a, UTF8stoUTF16s); - // cellL10n.AddFunc(0xf9b1896d, SJISstoUCS2s); - // cellL10n.AddFunc(0xfa4a675a, BIG5stoUCS2s); - // cellL10n.AddFunc(0xfdbf6ac5, UTF8stoUCS2s); + // cellL10n->AddFunc(0x005200e6, UCS2toEUCJP); + // cellL10n->AddFunc(0x01b0cbf4, l10n_convert); + // cellL10n->AddFunc(0x0356038c, UCS2toUTF32); + // cellL10n->AddFunc(0x05028763, jis2kuten); + // cellL10n->AddFunc(0x058addc8, UTF8toGB18030); + // cellL10n->AddFunc(0x060ee3b2, JISstoUTF8s); + // cellL10n->AddFunc(0x07168a83, SjisZen2Han); + // cellL10n->AddFunc(0x0bc386c8, ToSjisLower); + // cellL10n->AddFunc(0x0bedf77d, UCS2toGB18030); + // cellL10n->AddFunc(0x0bf867e2, HZstoUCS2s); + // cellL10n->AddFunc(0x0ce278fd, UCS2stoHZs); + // cellL10n->AddFunc(0x0d90a48d, UCS2stoSJISs); + // cellL10n->AddFunc(0x0f624540, kuten2eucjp); + // cellL10n->AddFunc(0x14ee3649, sjis2jis); + // cellL10n->AddFunc(0x14f504b8, EUCKRstoUCS2s); + // cellL10n->AddFunc(0x16eaf5f1, UHCstoEUCKRs); + // cellL10n->AddFunc(0x1758053c, jis2sjis); + // cellL10n->AddFunc(0x1906ce6b, jstrnchk); + // cellL10n->AddFunc(0x1ac0d23d, L10nConvert); + // cellL10n->AddFunc(0x1ae2acee, EUCCNstoUTF8s); + // cellL10n->AddFunc(0x1cb1138f, GBKstoUCS2s); + // cellL10n->AddFunc(0x1da42d70, eucjphan2zen); + // cellL10n->AddFunc(0x1ec712e0, ToSjisHira); + // cellL10n->AddFunc(0x1fb50183, GBKtoUCS2); + // cellL10n->AddFunc(0x21948c03, eucjp2jis); + // cellL10n->AddFunc(0x21aa3045, UTF32stoUTF8s); + // cellL10n->AddFunc(0x24fd32a9, sjishan2zen); + // cellL10n->AddFunc(0x256b6861, UCS2toSBCS); + // cellL10n->AddFunc(0x262a5ae2, UTF8stoGBKs); + // cellL10n->AddFunc(0x28724522, UTF8toUCS2); + // cellL10n->AddFunc(0x2ad091c6, UCS2stoUTF8s); + // cellL10n->AddFunc(0x2b84030c, EUCKRstoUTF8s); + // cellL10n->AddFunc(0x2efa7294, UTF16stoUTF32s); + // cellL10n->AddFunc(0x2f9eb543, UTF8toEUCKR); + // cellL10n->AddFunc(0x317ab7c2, UTF16toUTF8); + // cellL10n->AddFunc(0x32689828, ARIBstoUTF8s); + // cellL10n->AddFunc(0x33435818, SJISstoUTF8s); + // cellL10n->AddFunc(0x33f8b35c, sjiszen2han); + // cellL10n->AddFunc(0x3968f176, ToEucJpLower); + // cellL10n->AddFunc(0x398a3dee, MSJIStoUTF8); + // cellL10n->AddFunc(0x3a20bc34, UCS2stoMSJISs); + // cellL10n->AddFunc(0x3dabd5a7, EUCJPtoUTF8); + // cellL10n->AddFunc(0x3df65b64, eucjp2sjis); + // cellL10n->AddFunc(0x408a622b, ToEucJpHira); + // cellL10n->AddFunc(0x41b4a5ae, UHCstoUCS2s); + // cellL10n->AddFunc(0x41ccf033, ToEucJpKata); + // cellL10n->AddFunc(0x42838145, HZstoUTF8s); + // cellL10n->AddFunc(0x4931b44e, UTF8toMSJIS); + // cellL10n->AddFunc(0x4b3bbacb, BIG5toUTF8); + // cellL10n->AddFunc(0x511d386b, EUCJPstoSJISs); + // cellL10n->AddFunc(0x52b7883f, UTF8stoBIG5s); + // cellL10n->AddFunc(0x53558b6b, UTF16stoUCS2s); + // cellL10n->AddFunc(0x53764725, UCS2stoGB18030s); + // cellL10n->AddFunc(0x53c71ac2, EUCJPtoSJIS); + // cellL10n->AddFunc(0x54f59807, EUCJPtoUCS2); + // cellL10n->AddFunc(0x55f6921c, UCS2stoGBKs); + // cellL10n->AddFunc(0x58246762, EUCKRtoUHC); + // cellL10n->AddFunc(0x596df41c, UCS2toSJIS); + // cellL10n->AddFunc(0x5a4ab223, MSJISstoUTF8s); + // cellL10n->AddFunc(0x5ac783dc, EUCJPstoUTF8s); + // cellL10n->AddFunc(0x5b684dfb, UCS2toBIG5); + // cellL10n->AddFunc(0x5cd29270, UTF8stoEUCKRs); + // cellL10n->AddFunc(0x5e1d9330, UHCstoUTF8s); + // cellL10n->AddFunc(0x60ffa0ec, GB18030stoUCS2s); + // cellL10n->AddFunc(0x6122e000, SJIStoUTF8); + // cellL10n->AddFunc(0x6169f205, JISstoSJISs); + // cellL10n->AddFunc(0x61fb9442, UTF8toUTF16); + // cellL10n->AddFunc(0x62b36bcf, UTF8stoMSJISs); + // cellL10n->AddFunc(0x63219199, EUCKRtoUTF8); + // cellL10n->AddFunc(0x638c2fc1, SjisHan2Zen); + // cellL10n->AddFunc(0x64a10ec8, UCS2toUTF16); + // cellL10n->AddFunc(0x65444204, UCS2toMSJIS); + // cellL10n->AddFunc(0x6621a82c, sjis2kuten); + // cellL10n->AddFunc(0x6a6f25d1, UCS2toUHC); + // cellL10n->AddFunc(0x6c62d879, UTF32toUCS2); + // cellL10n->AddFunc(0x6de4b508, ToSjisUpper); + // cellL10n->AddFunc(0x6e0705c4, UTF8toEUCJP); + // cellL10n->AddFunc(0x6e5906fd, UCS2stoEUCJPs); + // cellL10n->AddFunc(0x6fc530b3, UTF16toUCS2); + // cellL10n->AddFunc(0x714a9b4a, UCS2stoUTF16s); + // cellL10n->AddFunc(0x71804d64, UCS2stoEUCCNs); + // cellL10n->AddFunc(0x72632e53, SBCSstoUTF8s); + // cellL10n->AddFunc(0x73f2cd21, SJISstoJISs); + // cellL10n->AddFunc(0x74496718, SBCStoUTF8); + // cellL10n->AddFunc(0x74871fe0, UTF8toUTF32); + cellL10n->AddFunc(0x750c363d, jstrchk); + // cellL10n->AddFunc(0x7c5bde1c, UHCtoEUCKR); + // cellL10n->AddFunc(0x7c912bda, kuten2jis); + // cellL10n->AddFunc(0x7d07a1c2, UTF8toEUCCN); + // cellL10n->AddFunc(0x8171c1cc, EUCCNtoUTF8); + // cellL10n->AddFunc(0x82d5ecdf, EucJpZen2Han); + // cellL10n->AddFunc(0x8555fe15, UTF32stoUTF16s); + // cellL10n->AddFunc(0x860fc741, GBKtoUTF8); + // cellL10n->AddFunc(0x867f7b8b, ToEucJpUpper); + // cellL10n->AddFunc(0x88f8340b, UCS2stoJISs); + // cellL10n->AddFunc(0x89236c86, UTF8stoGB18030s); + // cellL10n->AddFunc(0x8a56f148, EUCKRstoUHCs); + // cellL10n->AddFunc(0x8ccdba38, UTF8stoUTF32s); + // cellL10n->AddFunc(0x8f472054, UTF8stoEUCCNs); + // cellL10n->AddFunc(0x90e9b5d2, EUCJPstoUCS2s); + // cellL10n->AddFunc(0x91a99765, UHCtoUCS2); + // cellL10n->AddFunc(0x931ff25a, L10nConvertStr); + // cellL10n->AddFunc(0x949bb14c, GBKstoUTF8s); + // cellL10n->AddFunc(0x9557ac9b, UTF8toUHC); + // cellL10n->AddFunc(0x9768b6d3, UTF32toUTF8); + // cellL10n->AddFunc(0x9874020d, sjis2eucjp); + // cellL10n->AddFunc(0x9a0e7d23, UCS2toEUCCN); + // cellL10n->AddFunc(0x9a13d6b8, UTF8stoUHCs); + // cellL10n->AddFunc(0x9a72059d, EUCKRtoUCS2); + // cellL10n->AddFunc(0x9b1210c6, UTF32toUTF16); + // cellL10n->AddFunc(0x9cd8135b, EUCCNstoUCS2s); + // cellL10n->AddFunc(0x9ce52809, SBCSstoUCS2s); + // cellL10n->AddFunc(0x9cf1ab77, UTF8stoJISs); + // cellL10n->AddFunc(0x9d14dc46, ToSjisKata); + // cellL10n->AddFunc(0x9dcde367, jis2eucjp); + // cellL10n->AddFunc(0x9ec52258, BIG5toUCS2); + // cellL10n->AddFunc(0xa0d463c0, UCS2toGBK); + // cellL10n->AddFunc(0xa19fb9de, UTF16toUTF32); + // cellL10n->AddFunc(0xa298cad2, l10n_convert_str); + // cellL10n->AddFunc(0xa34fa0eb, EUCJPstoJISs); + // cellL10n->AddFunc(0xa5146299, UTF8stoARIBs); + // cellL10n->AddFunc(0xa609f3e9, JISstoEUCJPs); + // cellL10n->AddFunc(0xa60ff5c9, EucJpHan2Zen); + // cellL10n->AddFunc(0xa963619c, isEucJpKigou); + // cellL10n->AddFunc(0xa9a76fb8, UCS2toUTF8); + // cellL10n->AddFunc(0xaf18d499, GB18030toUCS2); + // cellL10n->AddFunc(0xb3361be6, UHCtoUTF8); + // cellL10n->AddFunc(0xb6e45343, MSJIStoUCS2); + // cellL10n->AddFunc(0xb7cef4a6, UTF8toGBK); + // cellL10n->AddFunc(0xb7e08f7a, kuten2sjis); + // cellL10n->AddFunc(0xb9cf473d, UTF8toSBCS); + // cellL10n->AddFunc(0xbdd44ee3, SJIStoUCS2); + // cellL10n->AddFunc(0xbe42e661, eucjpzen2han); + // cellL10n->AddFunc(0xbe8d5485, UCS2stoARIBs); + // cellL10n->AddFunc(0xbefe3869, isSjisKigou); + // cellL10n->AddFunc(0xc62b758d, UTF8stoEUCJPs); + // cellL10n->AddFunc(0xc7bdcb4c, UCS2toEUCKR); + // cellL10n->AddFunc(0xc944fa56, SBCStoUCS2); + // cellL10n->AddFunc(0xc9b78f58, MSJISstoUCS2s); + // cellL10n->AddFunc(0xcc1633cc, l10n_get_converter); + // cellL10n->AddFunc(0xd02ef83d, GB18030stoUTF8s); + // cellL10n->AddFunc(0xd8721e2c, SJISstoEUCJPs); + // cellL10n->AddFunc(0xd8cb24cb, UTF32stoUCS2s); + // cellL10n->AddFunc(0xd990858b, BIG5stoUTF8s); + // cellL10n->AddFunc(0xd9fb1224, EUCCNtoUCS2); + // cellL10n->AddFunc(0xda67b37f, UTF8stoSBCSs); + // cellL10n->AddFunc(0xdc54886c, UCS2stoEUCKRs); + // cellL10n->AddFunc(0xdd5ebdeb, UTF8stoSJISs); + // cellL10n->AddFunc(0xdefa1c17, UTF8stoHZs); + // cellL10n->AddFunc(0xe2eabb32, eucjp2kuten); + // cellL10n->AddFunc(0xe6d9e234, UTF8toBIG5); + cellL10n->AddFunc(0xe6f5711b, UTF16stoUTF8s); + // cellL10n->AddFunc(0xe956dc64, JISstoUCS2s); + // cellL10n->AddFunc(0xeabc3d00, GB18030toUTF8); + // cellL10n->AddFunc(0xeb3dc670, UTF8toSJIS); + // cellL10n->AddFunc(0xeb41cc68, ARIBstoUCS2s); + // cellL10n->AddFunc(0xeb685b83, UCS2stoUTF32s); + // cellL10n->AddFunc(0xebae29c0, UCS2stoSBCSs); + // cellL10n->AddFunc(0xee6c6a39, UCS2stoBIG5s); + // cellL10n->AddFunc(0xf1dcfa71, UCS2stoUHCs); + // cellL10n->AddFunc(0xf439728e, SJIStoEUCJP); + // cellL10n->AddFunc(0xf7681b9a, UTF8stoUTF16s); + // cellL10n->AddFunc(0xf9b1896d, SJISstoUCS2s); + // cellL10n->AddFunc(0xfa4a675a, BIG5stoUCS2s); + // cellL10n->AddFunc(0xfdbf6ac5, UTF8stoUCS2s); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp index aed1af162e..2874a0b3d4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp @@ -6,8 +6,9 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" -void cellNetCtl_init(); -Module cellNetCtl(0x0014, cellNetCtl_init); +//void cellNetCtl_init(); +//Module cellNetCtl(0x0014, cellNetCtl_init); +Module *cellNetCtl; // Error Codes enum @@ -72,7 +73,7 @@ int cellNetCtlTerm() int cellNetCtlGetState(mem32_t state) { - cellNetCtl.Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr()); + cellNetCtl->Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr()); if (!state.IsGood()) return CELL_NET_CTL_ERROR_INVALID_ADDR; @@ -125,18 +126,18 @@ int cellNetCtlGetNatInfo() void cellNetCtl_init() { - cellNetCtl.AddFunc(0xbd5a59fc, cellNetCtlInit); - cellNetCtl.AddFunc(0x105ee2cb, cellNetCtlTerm); + cellNetCtl->AddFunc(0xbd5a59fc, cellNetCtlInit); + cellNetCtl->AddFunc(0x105ee2cb, cellNetCtlTerm); - cellNetCtl.AddFunc(0x8b3eba69, cellNetCtlGetState); - cellNetCtl.AddFunc(0x0ce13c6b, cellNetCtlAddHandler); - cellNetCtl.AddFunc(0x901815c3, cellNetCtlDelHandler); + cellNetCtl->AddFunc(0x8b3eba69, cellNetCtlGetState); + cellNetCtl->AddFunc(0x0ce13c6b, cellNetCtlAddHandler); + cellNetCtl->AddFunc(0x901815c3, cellNetCtlDelHandler); - cellNetCtl.AddFunc(0x1e585b5d, cellNetCtlGetInfo); + cellNetCtl->AddFunc(0x1e585b5d, cellNetCtlGetInfo); - cellNetCtl.AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync); - cellNetCtl.AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync); - cellNetCtl.AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync); + cellNetCtl->AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync); + cellNetCtl->AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync); + cellNetCtl->AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync); - cellNetCtl.AddFunc(0x3a12865f, cellNetCtlGetNatInfo); + cellNetCtl->AddFunc(0x3a12865f, cellNetCtlGetNatInfo); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp index 42ccbc8f80..25907207e1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellOvis.cpp @@ -45,4 +45,4 @@ void cellOvis_init() cellOvis.AddFunc(0xce6cb776, cellOvisFixSpuSegments); cellOvis.AddFunc(0x629ba0c0, cellOvisInvalidateOverlappedSegments); } -#endif +#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index f3d20b252d..66c31b128a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -7,8 +7,10 @@ #include "Emu/SysCalls/Modules.h" #include "cellPamf.h" -void cellPamf_init(); -Module cellPamf(0x0012, cellPamf_init); +//void cellPamf_init(); +//Module cellPamf(0x0012, cellPamf_init); +Module *cellPamf = nullptr; + int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pEsFilterId) { @@ -30,7 +32,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pE pEsFilterId->supplementalInfo2 = 0; } else - cellPamf.Error("pamfStreamTypeToEsFilterId: invalid CELL_PAMF_STREAM_TYPE_AVC channel (ch=%d)", ch); + cellPamf->Error("pamfStreamTypeToEsFilterId: invalid CELL_PAMF_STREAM_TYPE_AVC channel (ch=%d)", ch); } break; case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS: @@ -42,7 +44,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pE pEsFilterId->supplementalInfo2 = 0; } else - cellPamf.Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS (ch=%d)", ch); + cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_ATRAC3PLUS (ch=%d)", ch); break; case CELL_PAMF_STREAM_TYPE_PAMF_LPCM: if (ch == 0) @@ -53,7 +55,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pE pEsFilterId->supplementalInfo2 = 0; } else - cellPamf.Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_LPCM (ch=%d)", ch); + cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_LPCM (ch=%d)", ch); break; case CELL_PAMF_STREAM_TYPE_USER_DATA: if (ch == 0) @@ -64,13 +66,13 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pE pEsFilterId->supplementalInfo2 = 0; } else - cellPamf.Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_USER_DATA (ch=%d)", ch); + cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_USER_DATA (ch=%d)", ch); break; case CELL_PAMF_STREAM_TYPE_AC3: - cellPamf.Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_AC3 (ch=%d)", ch); + cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_AC3 (ch=%d)", ch); break; case CELL_PAMF_STREAM_TYPE_M2V: - cellPamf.Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_M2V (ch=%d)", ch); + cellPamf->Error("*** TODO: pamfStreamTypeToEsFilterId: CELL_PAMF_STREAM_TYPE_M2V (ch=%d)", ch); break; default: return CELL_PAMF_ERROR_INVALID_ARG; @@ -90,7 +92,7 @@ u8 pamfGetStreamType(mem_ptr_t pSelf, u8 stream) case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM; case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA; default: - cellPamf.Error("pamfGetStreamType: (TODO) unsupported stream type found(0x%x)", + cellPamf->Error("pamfGetStreamType: (TODO) unsupported stream type found(0x%x)", pAddr->stream_headers[stream].type); return 0; } @@ -107,13 +109,13 @@ u8 pamfGetStreamChannel(mem_ptr_t pSelf, u8 stream) { return pAddr->stream_headers[stream].stream_id - 0xe0; } - cellPamf.Error("TODO: pamfGetStreamChannel (-> 0)"); + cellPamf->Error("TODO: pamfGetStreamChannel (-> 0)"); return 0; } int cellPamfGetHeaderSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pSize) { - cellPamf.Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", + cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) @@ -129,7 +131,7 @@ int cellPamfGetHeaderSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pSi int cellPamfGetHeaderSize2(mem_ptr_t pAddr, u64 fileSize, u32 attribute, mem64_t pSize) { - cellPamf.Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", + cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) @@ -145,7 +147,7 @@ int cellPamfGetHeaderSize2(mem_ptr_t pAddr, u64 fileSize, u32 attrib int cellPamfGetStreamOffsetAndSize(mem_ptr_t pAddr, u64 fileSize, mem64_t pOffset, mem64_t pSize) { - cellPamf.Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", + cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr()); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pOffset.IsGood() || !pSize.IsGood()) @@ -163,7 +165,7 @@ int cellPamfGetStreamOffsetAndSize(mem_ptr_t pAddr, u64 fileSize, me int cellPamfVerify(mem_ptr_t pAddr, u64 fileSize) { - cellPamf.Warning("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.GetAddr(), fileSize); + cellPamf->Warning("cellPamfVerify(pAddr=0x%x, fileSize=%d)", pAddr.GetAddr(), fileSize); if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048)) return CELL_PAMF_ERROR_INVALID_ARG; @@ -177,7 +179,7 @@ int cellPamfReaderInitialize(mem_ptr_t pSelf, mem_ptr_tWarning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pAddr.GetAddr(), 2048)) @@ -204,7 +206,7 @@ int cellPamfReaderInitialize(mem_ptr_t pSelf, mem_ptr_t pSelf, mem_ptr_t pTimeStamp) { - cellPamf.Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", + cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -219,7 +221,7 @@ int cellPamfReaderGetPresentationStartTime(mem_ptr_t pSelf, mem_ int cellPamfReaderGetPresentationEndTime(mem_ptr_t pSelf, mem_ptr_t pTimeStamp) { - cellPamf.Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", + cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -234,7 +236,7 @@ int cellPamfReaderGetPresentationEndTime(mem_ptr_t pSelf, mem_pt int cellPamfReaderGetMuxRateBound(mem_ptr_t pSelf) { - cellPamf.Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr()); + cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) return CELL_PAMF_ERROR_INVALID_ARG; @@ -245,7 +247,7 @@ int cellPamfReaderGetMuxRateBound(mem_ptr_t pSelf) int cellPamfReaderGetNumberOfStreams(mem_ptr_t pSelf) { - cellPamf.Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr()); + cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) return CELL_PAMF_ERROR_INVALID_ARG; @@ -256,7 +258,7 @@ int cellPamfReaderGetNumberOfStreams(mem_ptr_t pSelf) int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t pSelf, u8 streamType) { - cellPamf.Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", + cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.GetAddr(), streamType); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -292,7 +294,7 @@ int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t pSelf, u8 int cellPamfReaderSetStreamWithIndex(mem_ptr_t pSelf, u8 streamIndex) { - cellPamf.Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", + cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.GetAddr(), streamIndex); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -313,7 +315,7 @@ int cellPamfReaderSetStreamWithIndex(mem_ptr_t pSelf, u8 streamI int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t pSelf, u8 streamType, u8 ch) { - cellPamf.Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", + cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.GetAddr(), streamType, ch); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -323,7 +325,7 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t pSelf, u if (streamType > 5) { - cellPamf.Error("cellPamfReaderSetStreamWithTypeAndChannel: invalid stream type(%d)", streamType); + cellPamf->Error("cellPamfReaderSetStreamWithTypeAndChannel: invalid stream type(%d)", streamType); //it probably doesn't support "any audio" or "any video" argument return CELL_PAMF_ERROR_INVALID_ARG; } @@ -345,7 +347,7 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t pSelf, u int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t pSelf, u8 streamType, u8 streamIndex) { - cellPamf.Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", + cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.GetAddr(), streamType, streamIndex); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -396,7 +398,7 @@ int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t pSelf, u8 int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pEsFilterId) { - cellPamf.Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", + cellPamf->Warning("cellPamfStreamTypeToEsFilterId(type=%d, ch=%d, pEsFilterId_addr=0x%x)", type, ch, pEsFilterId.GetAddr()); if (!pEsFilterId.IsGood()) @@ -407,7 +409,7 @@ int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t pSelf) { - cellPamf.Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr()); + cellPamf->Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr()); if (!pSelf.IsGood()) return CELL_PAMF_ERROR_INVALID_ARG; @@ -417,7 +419,7 @@ int cellPamfReaderGetStreamIndex(mem_ptr_t pSelf) int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t pSelf, mem8_t pType, mem8_t pCh) { - cellPamf.Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", + cellPamf->Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr()); if (!pSelf.IsGood() || !pCh.IsGood()) @@ -430,7 +432,7 @@ int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t pSelf, mem8_ int cellPamfReaderGetEsFilterId(mem_ptr_t pSelf, mem_ptr_t pEsFilterId) { - cellPamf.Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", + cellPamf->Warning("cellPamfReaderGetEsFilterId(pSelf=0x%x (stream=%d), pEsFilterId_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, pEsFilterId.GetAddr()); if (!pSelf.IsGood() || !pEsFilterId.IsGood()) @@ -442,7 +444,7 @@ int cellPamfReaderGetEsFilterId(mem_ptr_t pSelf, mem_ptr_t pSelf, u32 pInfo_addr, u32 size) { - cellPamf.Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x (stream=%d), pInfo_addr=0x%x, size=%d)", + cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x (stream=%d), pInfo_addr=0x%x, size=%d)", pSelf.GetAddr(), pSelf->stream, pInfo_addr, size); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -461,7 +463,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, if (size != sizeof(CellPamfAvcInfo)) { - cellPamf.Error("cellPamfReaderGetStreamInfo: wrong AVC data size(%d)", size); + cellPamf->Error("cellPamfReaderGetStreamInfo: wrong AVC data size(%d)", size); return CELL_PAMF_ERROR_INVALID_ARG; } @@ -481,13 +483,13 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, pInfo->matrixCoefficients = 1; //fake //pInfo->deblockingFilterFlag = 1; //??? - cellPamf.Warning("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_AVC"); + cellPamf->Warning("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_AVC"); } break; case CELL_PAMF_STREAM_TYPE_M2V: { //TODO - cellPamf.Error("TODO: cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_M2V"); + cellPamf->Error("TODO: cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_M2V"); } break; case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS: @@ -497,7 +499,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, if (size != sizeof(CellPamfAtrac3plusInfo)) { - cellPamf.Error("cellPamfReaderGetStreamInfo: wrong ATRAC3+ data size(%d)", size); + cellPamf->Error("cellPamfReaderGetStreamInfo: wrong ATRAC3+ data size(%d)", size); return CELL_PAMF_ERROR_INVALID_ARG; } @@ -512,7 +514,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, if (size != sizeof(CellPamfAc3Info)) { - cellPamf.Error("cellPamfReaderGetStreamInfo: wrong AC3 data size(%d)", size); + cellPamf->Error("cellPamfReaderGetStreamInfo: wrong AC3 data size(%d)", size); return CELL_PAMF_ERROR_INVALID_ARG; } @@ -527,7 +529,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, if (size != sizeof(CellPamfLpcmInfo)) { - cellPamf.Error("cellPamfReaderGetStreamInfo: wrong LPCM data size(%d)", size); + cellPamf->Error("cellPamfReaderGetStreamInfo: wrong LPCM data size(%d)", size); return CELL_PAMF_ERROR_INVALID_ARG; } @@ -538,12 +540,12 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, pInfo->bitsPerSample = CELL_PAMF_BIT_LENGTH_16; else //TODO: CELL_PAMF_BIT_LENGTH_24 - cellPamf.Error("cellPamfReaderGetStreamInfo: unknown bps(0x%x)", (u8)pAudio->bps); + cellPamf->Error("cellPamfReaderGetStreamInfo: unknown bps(0x%x)", (u8)pAudio->bps); } break; case CELL_PAMF_STREAM_TYPE_USER_DATA: { - cellPamf.Error("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_USER_DATA"); + cellPamf->Error("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_USER_DATA"); return CELL_PAMF_ERROR_INVALID_ARG; } } @@ -553,7 +555,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t pSelf, u32 pInfo_addr, int cellPamfReaderGetNumberOfEp(mem_ptr_t pSelf) { - cellPamf.Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))", + cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))", pSelf.GetAddr(), pSelf->stream); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -565,7 +567,7 @@ int cellPamfReaderGetNumberOfEp(mem_ptr_t pSelf) int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t pSelf, u32 epIndex, mem_ptr_t pIt) { - cellPamf.Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x (stream=%d), epIndex=%d, pIt_addr=0x%x)", + cellPamf->Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x (stream=%d), epIndex=%d, pIt_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) @@ -578,7 +580,7 @@ int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t pSelf, u32 ep int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t pSelf, mem_ptr_t pTimeStamp, mem_ptr_t pIt) { - cellPamf.Error("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", + cellPamf->Error("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr()); const mem_ptr_t pAddr(pSelf->pAddr); @@ -588,41 +590,42 @@ int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t pSelf, me int cellPamfEpIteratorGetEp(mem_ptr_t pIt, mem_ptr_t pEp) { - cellPamf.Error("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.GetAddr(), pEp.GetAddr()); + cellPamf->Error("cellPamfEpIteratorGetEp(pIt_addr=0x%x, pEp_addr=0x%x)", pIt.GetAddr(), pEp.GetAddr()); //TODO: return CELL_OK; } int cellPamfEpIteratorMove(mem_ptr_t pIt, s32 steps, mem_ptr_t pEp) { - cellPamf.Error("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.GetAddr(), steps, pEp.GetAddr()); + cellPamf->Error("cellPamfEpIteratorMove(pIt_addr=0x%x, steps=%d, pEp_addr=0x%x)", pIt.GetAddr(), steps, pEp.GetAddr()); //TODO: return CELL_OK; } void cellPamf_init() { - cellPamf.AddFunc(0xca8181c1, cellPamfGetHeaderSize); - cellPamf.AddFunc(0x90fc9a59, cellPamfGetHeaderSize2); - cellPamf.AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize); - cellPamf.AddFunc(0xd1a40ef4, cellPamfVerify); - cellPamf.AddFunc(0xb8436ee5, cellPamfReaderInitialize); - cellPamf.AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime); - cellPamf.AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime); - cellPamf.AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound); - cellPamf.AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams); - cellPamf.AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams); - cellPamf.AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex); - cellPamf.AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel); - cellPamf.AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex); - cellPamf.AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId); - cellPamf.AddFunc(0x041cc708, cellPamfReaderGetStreamIndex); - cellPamf.AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel); - cellPamf.AddFunc(0x71df326a, cellPamfReaderGetEsFilterId); - cellPamf.AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo); - cellPamf.AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp); - cellPamf.AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex); - cellPamf.AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp); - cellPamf.AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp); - cellPamf.AddFunc(0x50b83205, cellPamfEpIteratorMove); + cellPamf->AddFunc(0xca8181c1, cellPamfGetHeaderSize); + cellPamf->AddFunc(0x90fc9a59, cellPamfGetHeaderSize2); + cellPamf->AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize); + cellPamf->AddFunc(0xd1a40ef4, cellPamfVerify); + cellPamf->AddFunc(0xb8436ee5, cellPamfReaderInitialize); + cellPamf->AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime); + cellPamf->AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime); + cellPamf->AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound); + cellPamf->AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams); + cellPamf->AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams); + cellPamf->AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex); + cellPamf->AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel); + cellPamf->AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex); + cellPamf->AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId); + cellPamf->AddFunc(0x041cc708, cellPamfReaderGetStreamIndex); + cellPamf->AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel); + cellPamf->AddFunc(0x71df326a, cellPamfReaderGetEsFilterId); + cellPamf->AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo); + cellPamf->AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp); + cellPamf->AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex); + cellPamf->AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp); + cellPamf->AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp); + cellPamf->AddFunc(0x50b83205, cellPamfEpIteratorMove); } + diff --git a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp index fcf6521d86..9281f3c17b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPhotoDecode.cpp @@ -65,4 +65,4 @@ void cellPhotoDecode_init() cellPhotoDecode.AddFunc(0xad7d8f38, cellPhotoDecodeFinalize); cellPhotoDecode.AddFunc(0x28b22e44, cellPhotoDecodeFromFile); } -#endif +#endif diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index 508e6234ea..448677dad1 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -9,8 +9,9 @@ #include "stblib/stb_image.h" #include -void cellPngDec_init(); -Module cellPngDec(0x0018, cellPngDec_init); +//void cellPngDec_init(); +//Module cellPngDec(0x0018, cellPngDec_init); +extern Module *cellPngDec = nullptr; static std::map cellPngDecMap; @@ -23,7 +24,7 @@ CellPngDecMainHandle *getCellPngDecCtx(u32 mainHandle) { int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) { - cellPngDec.Warning("cellPngDecCreate(mainHandle=0x%x, threadInParam=0x%x, threadOutParam=0x%x)", mainHandle, threadInParam, threadOutParam); + cellPngDec->Warning("cellPngDecCreate(mainHandle=0x%x, threadInParam=0x%x, threadOutParam=0x%x)", mainHandle, threadInParam, threadOutParam); CellPngDecMainHandle *ctx = new CellPngDecMainHandle; if (cellPngDecMap.find(mainHandle) != cellPngDecMap.end()) { delete cellPngDecMap[mainHandle]; @@ -39,10 +40,10 @@ int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) int cellPngDecDestroy(u32 mainHandle) { - cellPngDec.Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle); + cellPngDec->Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle); CellPngDecMainHandle *ctx = getCellPngDecCtx(mainHandle); if (!ctx) { - cellPngDec.Warning("cellPngDecDestroy(mainHandle=0x%x): bad handle", mainHandle); + cellPngDec->Warning("cellPngDecDestroy(mainHandle=0x%x): bad handle", mainHandle); return -1; } @@ -54,7 +55,7 @@ int cellPngDecDestroy(u32 mainHandle) int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t src, u32 openInfo) { - cellPngDec.Warning("cellPngDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)", + cellPngDec->Warning("cellPngDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)", mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo); if (!subHandle.IsGood() || !src.IsGood()) @@ -87,17 +88,17 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t s } // From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. - subHandle = cellPngDec.GetNewId(current_subHandle); + subHandle = cellPngDec->GetNewId(current_subHandle); return CELL_OK; } int cellPngDecClose(u32 mainHandle, u32 subHandle) { - cellPngDec.Warning("cellPngDecClose(mainHandle=0x%x,subHandle=0x%x)", mainHandle, subHandle); + cellPngDec->Warning("cellPngDecClose(mainHandle=0x%x,subHandle=0x%x)", mainHandle, subHandle); CellPngDecSubHandle* subHandle_data; - if(!cellPngDec.CheckId(subHandle, subHandle_data)) + if(!cellPngDec->CheckId(subHandle, subHandle_data)) return CELL_PNGDEC_ERROR_FATAL; cellFsClose(subHandle_data->fd); @@ -111,9 +112,9 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_tWarning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr()); CellPngDecSubHandle* subHandle_data; - if(!cellPngDec.CheckId(subHandle, subHandle_data)) + if(!cellPngDec->CheckId(subHandle, subHandle_data)) return CELL_PNGDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -173,7 +174,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP; CellPngDecSubHandle* subHandle_data; - if(!cellPngDec.CheckId(subHandle, subHandle_data)) + if(!cellPngDec->CheckId(subHandle, subHandle_data)) return CELL_PNGDEC_ERROR_FATAL; const u32& fd = subHandle_data->fd; @@ -211,6 +212,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m switch((u32)current_outParam.outputColorSpace) { case CELL_PNGDEC_RGB: + image_size = width * height; case CELL_PNGDEC_RGBA: { const char nComponents = current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3; @@ -278,7 +280,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m case CELL_PNGDEC_GRAYSCALE: case CELL_PNGDEC_PALETTE: case CELL_PNGDEC_GRAYSCALE_ALPHA: - cellPngDec.Error("cellPngDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); + cellPngDec->Error("cellPngDecDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); break; default: @@ -296,7 +298,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tCheckId(subHandle, subHandle_data)) return CELL_PNGDEC_ERROR_FATAL; CellPngDecInfo& current_info = subHandle_data->info; @@ -333,34 +335,34 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tAddFunc(0x157d30c5, cellPngDecCreate); + cellPngDec->AddFunc(0x820dae1a, cellPngDecDestroy); + cellPngDec->AddFunc(0xd2bc5bfd, cellPngDecOpen); + cellPngDec->AddFunc(0x5b3d1ff1, cellPngDecClose); + cellPngDec->AddFunc(0x9ccdcc95, cellPngDecReadHeader); + cellPngDec->AddFunc(0x2310f155, cellPngDecDecodeData); + cellPngDec->AddFunc(0xe97c9bd4, cellPngDecSetParameter); - /*cellPngDec.AddFunc(0x48436b2d, cellPngDecExtCreate); - cellPngDec.AddFunc(0x0c515302, cellPngDecExtOpen); - cellPngDec.AddFunc(0x8b33f863, cellPngDecExtReadHeader); - cellPngDec.AddFunc(0x726fc1d0, cellPngDecExtDecodeData); - cellPngDec.AddFunc(0x9e9d7d42, cellPngDecExtSetParameter); - cellPngDec.AddFunc(0x7585a275, cellPngDecGetbKGD); - cellPngDec.AddFunc(0x7a062d26, cellPngDecGetcHRM); - cellPngDec.AddFunc(0xb153629c, cellPngDecGetgAMA); - cellPngDec.AddFunc(0xb905ebb7, cellPngDecGethIST); - cellPngDec.AddFunc(0xf44b6c30, cellPngDecGetiCCP); - cellPngDec.AddFunc(0x27c921b5, cellPngDecGetoFFs); - cellPngDec.AddFunc(0xb4fe75e1, cellPngDecGetpCAL); - cellPngDec.AddFunc(0x3d50016a, cellPngDecGetpHYs); - cellPngDec.AddFunc(0x30cb334a, cellPngDecGetsBIT); - cellPngDec.AddFunc(0xc41e1198, cellPngDecGetsCAL); - cellPngDec.AddFunc(0xa5cdf57e, cellPngDecGetsPLT); - cellPngDec.AddFunc(0xe4416e82, cellPngDecGetsRGB); - cellPngDec.AddFunc(0x35a6846c, cellPngDecGettIME); - cellPngDec.AddFunc(0xb96fb26e, cellPngDecGettRNS); - cellPngDec.AddFunc(0xe163977f, cellPngDecGetPLTE); - cellPngDec.AddFunc(0x609ec7d5, cellPngDecUnknownChunks); - cellPngDec.AddFunc(0xb40ca175, cellPngDecGetTextChunk);*/ + /*cellPngDec->AddFunc(0x48436b2d, cellPngDecExtCreate); + cellPngDec->AddFunc(0x0c515302, cellPngDecExtOpen); + cellPngDec->AddFunc(0x8b33f863, cellPngDecExtReadHeader); + cellPngDec->AddFunc(0x726fc1d0, cellPngDecExtDecodeData); + cellPngDec->AddFunc(0x9e9d7d42, cellPngDecExtSetParameter); + cellPngDec->AddFunc(0x7585a275, cellPngDecGetbKGD); + cellPngDec->AddFunc(0x7a062d26, cellPngDecGetcHRM); + cellPngDec->AddFunc(0xb153629c, cellPngDecGetgAMA); + cellPngDec->AddFunc(0xb905ebb7, cellPngDecGethIST); + cellPngDec->AddFunc(0xf44b6c30, cellPngDecGetiCCP); + cellPngDec->AddFunc(0x27c921b5, cellPngDecGetoFFs); + cellPngDec->AddFunc(0xb4fe75e1, cellPngDecGetpCAL); + cellPngDec->AddFunc(0x3d50016a, cellPngDecGetpHYs); + cellPngDec->AddFunc(0x30cb334a, cellPngDecGetsBIT); + cellPngDec->AddFunc(0xc41e1198, cellPngDecGetsCAL); + cellPngDec->AddFunc(0xa5cdf57e, cellPngDecGetsPLT); + cellPngDec->AddFunc(0xe4416e82, cellPngDecGetsRGB); + cellPngDec->AddFunc(0x35a6846c, cellPngDecGettIME); + cellPngDec->AddFunc(0xb96fb26e, cellPngDecGettRNS); + cellPngDec->AddFunc(0xe163977f, cellPngDecGetPLTE); + cellPngDec->AddFunc(0x609ec7d5, cellPngDecUnknownChunks); + cellPngDec->AddFunc(0xb40ca175, cellPngDecGetTextChunk);*/ } diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 0a58d81acc..aaa1a464f8 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -7,10 +7,11 @@ #include "Emu/SysCalls/Modules.h" #include "cellResc.h" -void cellResc_init(); -void cellResc_load(); -void cellResc_unload(); -Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload); +//void cellResc_init(); +//void cellResc_load(); +//void cellResc_unload(); +//Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload); +Module *cellResc = nullptr; // Error Codes enum @@ -419,16 +420,16 @@ void InitVertex(mem_ptr_t& cntxt) // Module Functions int cellRescInit(mem_ptr_t initConfig) { - cellResc.Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.GetAddr()); + cellResc->Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.GetAddr()); if (s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED"); + cellResc->Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED"); return CELL_RESC_ERROR_REINITIALIZED; } if (!initConfig.IsGood() || InternalVersion(initConfig.GetAddr()) == -1 || !CheckInitConfig(initConfig)) { - cellResc.Error("cellRescInit : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescInit : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -441,11 +442,11 @@ int cellRescInit(mem_ptr_t initConfig) void cellRescExit() { - cellResc.Warning("cellRescExit()"); + cellResc->Warning("cellRescExit()"); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescExit()"); + cellResc->Error("cellRescExit()"); return; } @@ -456,11 +457,11 @@ void cellRescExit() int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t bufferMode) { - cellResc.Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.GetAddr()); + cellResc->Log("cellRescVideoOutResolutionId2RescBufferMode(resolutionId=%d, bufferMode_addr=0x%x)", resolutionId, bufferMode.GetAddr()); if (!bufferMode.IsGood()) { - cellResc.Error("cellRescVideoOutResolutionId2RescBufferMode : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescVideoOutResolutionId2RescBufferMode : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -471,7 +472,7 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t buffer case CELL_VIDEO_OUT_RESOLUTION_480: bufferMode = CELL_RESC_720x480; break; case CELL_VIDEO_OUT_RESOLUTION_576: bufferMode = CELL_RESC_720x576; break; default: - cellResc.Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -480,24 +481,24 @@ int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t buffer int cellRescSetDsts(u32 dstsMode, mem_ptr_t dsts) { - cellResc.Log("cellRescSetDsts(dstsMode=%d, CellRescDsts_addr=0x%x)", dstsMode, dsts.GetAddr()); + cellResc->Log("cellRescSetDsts(dstsMode=%d, CellRescDsts_addr=0x%x)", dstsMode, dsts.GetAddr()); if (!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetDst : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetDst : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if (!dsts.IsGood()) { - cellResc.Error("cellRescSetDst : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetDst : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) && (dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080)) { - cellResc.Error("cellRescSetDsts : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetDsts : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -508,24 +509,24 @@ int cellRescSetDsts(u32 dstsMode, mem_ptr_t dsts) int cellRescSetDisplayMode(u32 displayMode) { - cellResc.Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode); + cellResc->Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode); if (!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if (!(s_rescInternalInstance->m_initConfig.supportModes & displayMode)) { - cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } if ((displayMode != CELL_RESC_720x480) && (displayMode != CELL_RESC_720x576) && (displayMode != CELL_RESC_1280x720) && (displayMode != CELL_RESC_1920x1080)) { - cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -533,13 +534,13 @@ int cellRescSetDisplayMode(u32 displayMode) if ((IsPalInterpolate() || IsPalDrop()) && s_rescInternalInstance->m_initConfig.flipMode == CELL_RESC_DISPLAY_HSYNC) { - cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); + cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); return CELL_RESC_ERROR_BAD_COMBINATION; } if(IsPal60Hsync() && s_rescInternalInstance->m_initConfig.flipMode==CELL_RESC_DISPLAY_VSYNC) { - cellResc.Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); + cellResc->Error("cellRescSetDisplayMode : CELL_RESC_ERROR_BAD_COMBINATIONT"); return CELL_RESC_ERROR_BAD_COMBINATION; } @@ -598,17 +599,17 @@ int cellRescSetDisplayMode(u32 displayMode) int cellRescAdjustAspectRatio(float horizontal, float vertical) { - cellResc.Warning("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical); + cellResc->Warning("cellRescAdjustAspectRatio(horizontal=%f, vertical=%f)", horizontal, vertical); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if((horizontal < 0.5f || 2.f < horizontal) || (vertical < 0.5f || 2.f < vertical)) { - cellResc.Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescAdjustAspectRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -628,17 +629,17 @@ int cellRescAdjustAspectRatio(float horizontal, float vertical) int cellRescSetPalInterpolateDropFlexRatio(float ratio) { - cellResc.Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); + cellResc->Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if(ratio < 0.f || 1.f < ratio) { - cellResc.Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetPalInterpolateDropFlexRatio : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -649,11 +650,11 @@ int cellRescSetPalInterpolateDropFlexRatio(float ratio) int cellRescGetBufferSize(mem32_t colorBuffers, mem32_t vertexArray, mem32_t fragmentShader) { - cellResc.Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.GetAddr(), vertexArray.GetAddr(), fragmentShader.GetAddr()); + cellResc->Warning("cellRescGetBufferSize(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.GetAddr(), vertexArray.GetAddr(), fragmentShader.GetAddr()); if (!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescGetBufferSize : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescGetBufferSize : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } @@ -681,11 +682,11 @@ int cellRescGetBufferSize(mem32_t colorBuffers, mem32_t vertexArray, mem32_t fra int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved) { - cellResc.Log("cellRescGetNumColorBuffers(dstMode=%d, palTemporalMode=%d, reserved=%d)", dstMode, palTemporalMode, reserved); + cellResc->Log("cellRescGetNumColorBuffers(dstMode=%d, palTemporalMode=%d, reserved=%d)", dstMode, palTemporalMode, reserved); if (reserved != 0) { - cellResc.Error("cellRescGetNumColorBuffers : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescGetNumColorBuffers : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -702,11 +703,11 @@ int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved) int cellRescGcmSurface2RescSrc(mem_ptr_t gcmSurface, mem_ptr_t rescSrc) { - cellResc.Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)", gcmSurface.GetAddr(), rescSrc.GetAddr()); + cellResc->Log("cellRescGcmSurface2RescSrc(gcmSurface_addr=0x%x, rescSrc_addr=0x%x)", gcmSurface.GetAddr(), rescSrc.GetAddr()); if(!gcmSurface.IsGood() || !rescSrc.IsGood()) { - cellResc.Error("cellRescGcmSurface2RescSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescGcmSurface2RescSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -732,32 +733,32 @@ int cellRescGcmSurface2RescSrc(mem_ptr_t gcmSurface, mem_ptr_t src) { - cellResc.Log("cellRescSetSrc(idx=0x%x, src_addr=0x%x)", idx, src.GetAddr()); + cellResc->Log("cellRescSetSrc(idx=0x%x, src_addr=0x%x)", idx, src.GetAddr()); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetSrc : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if(idx < 0 || SRC_BUFFER_NUM <= idx || !src.IsGood()) { - cellResc.Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } if(src->width < 1 || 4096 < src->width || src->height < 1 || 4096 < src->height) { - cellResc.Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetSrc : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } - cellResc.Log(" *** format=0x%x", src->format.ToLE()); - cellResc.Log(" *** pitch=%d", src->pitch.ToLE()); - cellResc.Log(" *** width=%d", src->width.ToLE()); - cellResc.Log(" *** height=%d", src->height.ToLE()); - cellResc.Log(" *** offset=0x%x", src->offset.ToLE()); + cellResc->Log(" *** format=0x%x", src->format.ToLE()); + cellResc->Log(" *** pitch=%d", src->pitch.ToLE()); + cellResc->Log(" *** width=%d", src->width.ToLE()); + cellResc->Log(" *** height=%d", src->height.ToLE()); + cellResc->Log(" *** offset=0x%x", src->offset.ToLE()); //Emu.GetGSManager().GetRender().SetData(src.offset, 800, 600); //Emu.GetGSManager().GetRender().Draw(); @@ -770,17 +771,17 @@ int cellRescSetSrc(s32 idx, mem_ptr_t src) int cellRescSetConvertAndFlip(mem_ptr_t cntxt, s32 idx) { - cellResc.Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.GetAddr(), idx); + cellResc->Log("cellRescSetConvertAndFlip(cntxt_addr=0x%x, indx=0x%x)", cntxt.GetAddr(), idx); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if(idx < 0 || SRC_BUFFER_NUM <= idx) { - cellResc.Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetConvertAndFlip : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -800,7 +801,7 @@ int cellRescSetConvertAndFlip(mem_ptr_t cntxt, s32 idx) int cellRescSetWaitFlip() { - cellResc.Log("cellRescSetWaitFlip()"); + cellResc->Log("cellRescSetWaitFlip()"); GSLockCurrent lock(GS_LOCK_WAIT_FLIP); // could stall on exit return CELL_OK; @@ -808,17 +809,17 @@ int cellRescSetWaitFlip() int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t fragmentShader) { - cellResc.Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.GetAddr(), vertexArray.GetAddr(), fragmentShader.GetAddr()); + cellResc->Warning("cellRescSetBufferAddress(colorBuffers_addr=0x%x, vertexArray_addr=0x%x, fragmentShader_addr=0x%x)", colorBuffers.GetAddr(), vertexArray.GetAddr(), fragmentShader.GetAddr()); if(!s_rescInternalInstance->m_bInitialized) { - cellResc.Error("cellRescSetBufferAddress : CELL_RESC_ERROR_NOT_INITIALIZED"); + cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_NOT_INITIALIZED"); return CELL_RESC_ERROR_NOT_INITIALIZED; } if(!colorBuffers.IsGood() || !vertexArray.IsGood() || !fragmentShader.IsGood()) { - cellResc.Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -826,7 +827,7 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t vertexArray.GetAddr() % VERTEX_BUFFER_ALIGNMENT || fragmentShader.GetAddr() % FRAGMENT_SHADER_ALIGNMENT) { - cellResc.Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ARGUMENT"); + cellResc->Error("cellRescSetBufferAddress : CELL_RESC_ERROR_BAD_ARGUMENT"); return CELL_RESC_ERROR_BAD_ARGUMENT; } @@ -858,11 +859,11 @@ int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t int cellRescSetFlipHandler(u32 handler_addr) { - cellResc.Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler_addr); + cellResc->Warning("cellRescSetFlipHandler(handler_addr=0x%x)", handler_addr); if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr)) { - cellResc.Error("cellRescSetFlipHandler : CELL_EFAULT"); + cellResc->Error("cellRescSetFlipHandler : CELL_EFAULT"); return CELL_EFAULT; } @@ -873,14 +874,14 @@ int cellRescSetFlipHandler(u32 handler_addr) void cellRescResetFlipStatus() { - cellResc.Log("cellRescResetFlipStatus()"); + cellResc->Log("cellRescResetFlipStatus()"); Emu.GetGSManager().GetRender().m_flip_status = 1; } int cellRescGetFlipStatus() { - cellResc.Log("cellRescGetFlipStatus()"); + cellResc->Log("cellRescGetFlipStatus()"); return Emu.GetGSManager().GetRender().m_flip_status; } @@ -918,28 +919,28 @@ int cellRescCreateInterlaceTable() void cellResc_init() { - cellResc.AddFunc(0x25c107e6, cellRescSetConvertAndFlip); - cellResc.AddFunc(0x0d3c22ce, cellRescSetWaitFlip); - cellResc.AddFunc(0x2ea94661, cellRescSetFlipHandler); - cellResc.AddFunc(0x01220224, cellRescGcmSurface2RescSrc); - cellResc.AddFunc(0x0a2069c7, cellRescGetNumColorBuffers); - cellResc.AddFunc(0x10db5b1a, cellRescSetDsts); - cellResc.AddFunc(0x129922a0, cellRescResetFlipStatus); - cellResc.AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio); - cellResc.AddFunc(0x1dd3c4cd, cellRescGetRegisterCount); - cellResc.AddFunc(0x22ae06d8, cellRescAdjustAspectRatio); - cellResc.AddFunc(0x23134710, cellRescSetDisplayMode); - cellResc.AddFunc(0x2ea3061e, cellRescExit); - cellResc.AddFunc(0x516ee89e, cellRescInit); - cellResc.AddFunc(0x5a338cdb, cellRescGetBufferSize); - cellResc.AddFunc(0x66f5e388, cellRescGetLastFlipTime); - cellResc.AddFunc(0x6cd0f95f, cellRescSetSrc); - cellResc.AddFunc(0x7af8a37f, cellRescSetRegisterCount); - cellResc.AddFunc(0x8107277c, cellRescSetBufferAddress); - cellResc.AddFunc(0xc47c5c22, cellRescGetFlipStatus); - cellResc.AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode); - cellResc.AddFunc(0xd3758645, cellRescSetVBlankHandler); - cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable); + cellResc->AddFunc(0x25c107e6, cellRescSetConvertAndFlip); + cellResc->AddFunc(0x0d3c22ce, cellRescSetWaitFlip); + cellResc->AddFunc(0x2ea94661, cellRescSetFlipHandler); + cellResc->AddFunc(0x01220224, cellRescGcmSurface2RescSrc); + cellResc->AddFunc(0x0a2069c7, cellRescGetNumColorBuffers); + cellResc->AddFunc(0x10db5b1a, cellRescSetDsts); + cellResc->AddFunc(0x129922a0, cellRescResetFlipStatus); + cellResc->AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio); + cellResc->AddFunc(0x1dd3c4cd, cellRescGetRegisterCount); + cellResc->AddFunc(0x22ae06d8, cellRescAdjustAspectRatio); + cellResc->AddFunc(0x23134710, cellRescSetDisplayMode); + cellResc->AddFunc(0x2ea3061e, cellRescExit); + cellResc->AddFunc(0x516ee89e, cellRescInit); + cellResc->AddFunc(0x5a338cdb, cellRescGetBufferSize); + cellResc->AddFunc(0x66f5e388, cellRescGetLastFlipTime); + cellResc->AddFunc(0x6cd0f95f, cellRescSetSrc); + cellResc->AddFunc(0x7af8a37f, cellRescSetRegisterCount); + cellResc->AddFunc(0x8107277c, cellRescSetBufferAddress); + cellResc->AddFunc(0xc47c5c22, cellRescGetFlipStatus); + cellResc->AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode); + cellResc->AddFunc(0xd3758645, cellRescSetVBlankHandler); + cellResc->AddFunc(0xe0cef79e, cellRescCreateInterlaceTable); } void cellResc_load() diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index c82adf7415..9ac5b8462b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -8,8 +8,9 @@ #include "cellRtc.h" -void cellRtc_init(); -Module cellRtc(0x0009, cellRtc_init); +//void cellRtc_init(); +//Module cellRtc(0x0009, cellRtc_init); +Module *cellRtc = nullptr; long convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years) { @@ -26,76 +27,76 @@ u64 convertToWin32FILETIME(u16 seconds, u16 minutes, u16 hours, u16 days, int ye int cellRtcGetCurrentTick(mem_ptr_t pTick) { - cellRtc.Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.GetAddr()); + cellRtc->Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.GetAddr()); if (!pTick.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime unow = wxDateTime::UNow(); + rDateTime unow = rDateTime::UNow(); pTick->tick = unow.GetTicks(); return CELL_OK; } int cellRtcGetCurrentClock(mem_ptr_t pClock, s32 iTimeZone) { - cellRtc.Log("cellRtcGetCurrentClock(pClock=0x%x, time_zone=%d)", pClock.GetAddr(), iTimeZone); + cellRtc->Log("cellRtcGetCurrentClock(pClock=0x%x, time_zone=%d)", pClock.GetAddr(), iTimeZone); if (!pClock.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime unow = wxDateTime::UNow(); + rDateTime unow = rDateTime::UNow(); // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); + rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); unow.Add(tz); - pClock->year = unow.GetYear(wxDateTime::TZ::UTC); - pClock->month = unow.GetMonth(wxDateTime::TZ::UTC); - pClock->day = unow.GetDay(wxDateTime::TZ::UTC); - pClock->hour = unow.GetHour(wxDateTime::TZ::UTC); - pClock->minute = unow.GetMinute(wxDateTime::TZ::UTC); - pClock->second = unow.GetSecond(wxDateTime::TZ::UTC); - pClock->microsecond = unow.GetMillisecond(wxDateTime::TZ::UTC) * 1000; + pClock->year = unow.GetYear(rDateTime::TZ::UTC); + pClock->month = unow.GetMonth(rDateTime::TZ::UTC); + pClock->day = unow.GetDay(rDateTime::TZ::UTC); + pClock->hour = unow.GetHour(rDateTime::TZ::UTC); + pClock->minute = unow.GetMinute(rDateTime::TZ::UTC); + pClock->second = unow.GetSecond(rDateTime::TZ::UTC); + pClock->microsecond = unow.GetMillisecond(rDateTime::TZ::UTC) * 1000; return CELL_OK; } int cellRtcGetCurrentClockLocalTime(mem_ptr_t pClock) { - cellRtc.Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.GetAddr()); + cellRtc->Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.GetAddr()); if (!pClock.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime unow = wxDateTime::UNow(); + rDateTime unow = rDateTime::UNow(); - pClock->year = unow.GetYear(wxDateTime::TZ::Local); - pClock->month = unow.GetMonth(wxDateTime::TZ::Local); - pClock->day = unow.GetDay(wxDateTime::TZ::Local); - pClock->hour = unow.GetHour(wxDateTime::TZ::Local); - pClock->minute = unow.GetMinute(wxDateTime::TZ::Local); - pClock->second = unow.GetSecond(wxDateTime::TZ::Local); - pClock->microsecond = unow.GetMillisecond(wxDateTime::TZ::Local) * 1000; + pClock->year = unow.GetYear(rDateTime::TZ::Local); + pClock->month = unow.GetMonth(rDateTime::TZ::Local); + pClock->day = unow.GetDay(rDateTime::TZ::Local); + pClock->hour = unow.GetHour(rDateTime::TZ::Local); + pClock->minute = unow.GetMinute(rDateTime::TZ::Local); + pClock->second = unow.GetSecond(rDateTime::TZ::Local); + pClock->microsecond = unow.GetMillisecond(rDateTime::TZ::Local) * 1000; return CELL_OK; } int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 iTimeZone) { - cellRtc.Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone); + cellRtc->Log("cellRtcFormatRfc2822(pszDateTime_addr=0x%x, pUtc=0x%x, time_zone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); + rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); // Get date from ticks + tz. - wxDateTime date = wxDateTime((time_t)pUtc->tick); + rDateTime date = rDateTime((time_t)pUtc->tick); date.Add(tz); // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). - const std::string& str = fmt::ToUTF8(date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::UTC)); + const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::UTC); Memory.WriteString(pszDateTime_addr, str); return CELL_OK; @@ -103,16 +104,16 @@ int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t pUtc) { - cellRtc.Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr()); + cellRtc->Log("cellRtcFormatRfc2822LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr()); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Get date from ticks. - wxDateTime date = wxDateTime((time_t)pUtc->tick); + rDateTime date = rDateTime((time_t)pUtc->tick); // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). - const std::string& str = fmt::ToUTF8(date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::Local)); + const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::Local); Memory.WriteString(pszDateTime_addr, str); return CELL_OK; @@ -120,20 +121,20 @@ int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t p int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 iTimeZone) { - cellRtc.Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone); + cellRtc->Log("cellRtcFormatRfc3339(pszDateTime_addr=0x%x, pUtc=0x%x, iTimeZone=%d)", pszDateTime_addr, pUtc.GetAddr(), iTimeZone); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); + rTimeSpan tz = rTimeSpan(0, (long) iTimeZone, 0, 0); // Get date from ticks + tz. - wxDateTime date = wxDateTime((time_t)pUtc->tick); + rDateTime date = rDateTime((time_t)pUtc->tick); date.Add(tz); // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). - const std::string& str = fmt::ToUTF8(date.Format("%FT%T.%zZ", wxDateTime::TZ::UTC)); + const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::UTC); Memory.WriteString(pszDateTime_addr, str); return CELL_OK; @@ -141,16 +142,16 @@ int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t pUtc) { - cellRtc.Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr()); + cellRtc->Log("cellRtcFormatRfc3339LocalTime(pszDateTime_addr=0x%x, pUtc=0x%x)", pszDateTime_addr, pUtc.GetAddr()); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Get date from ticks. - wxDateTime date = wxDateTime((time_t) pUtc->tick); + rDateTime date = rDateTime((time_t) pUtc->tick); // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). - const std::string& str = fmt::ToUTF8(date.Format("%FT%T.%zZ", wxDateTime::TZ::Local)); + const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::Local); Memory.WriteString(pszDateTime_addr, str); return CELL_OK; @@ -158,15 +159,15 @@ int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t p int cellRtcParseDateTime(mem_ptr_t pUtc, u32 pszDateTime_addr) { - cellRtc.Log("cellRtcParseDateTime(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr); + cellRtc->Log("cellRtcParseDateTime(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Get date from formatted string. - wxDateTime date; + rDateTime date; const std::string& format = Memory.ReadString(pszDateTime_addr); - date.ParseDateTime(fmt::FromUTF8(format)); + date.ParseDateTime(format); pUtc->tick = date.GetTicks(); @@ -175,15 +176,15 @@ int cellRtcParseDateTime(mem_ptr_t pUtc, u32 pszDateTime_addr) int cellRtcParseRfc3339(mem_ptr_t pUtc, u32 pszDateTime_addr) { - cellRtc.Log("cellRtcParseRfc3339(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr); + cellRtc->Log("cellRtcParseRfc3339(pUtc=0x%x, pszDateTime_addr=0x%x)", pUtc.GetAddr(), pszDateTime_addr); if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr)) return CELL_RTC_ERROR_INVALID_POINTER; // Get date from RFC3339 formatted string. - wxDateTime date; + rDateTime date; const std::string& format = Memory.ReadString(pszDateTime_addr); - date.ParseDateTime(fmt::FromUTF8(format)); + date.ParseDateTime(format); pUtc->tick = date.GetTicks(); @@ -192,12 +193,12 @@ int cellRtcParseRfc3339(mem_ptr_t pUtc, u32 pszDateTime_addr) int cellRtcGetTick(mem_ptr_t pTime, mem_ptr_t pTick) { - cellRtc.Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr()); + cellRtc->Log("cellRtcGetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr()); if (!pTime.IsGood() || !pTick.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime datetime = wxDateTime(pTime->day, (wxDateTime::Month)pTime->month.ToLE(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000)); + rDateTime datetime = rDateTime(pTime->day, (rDateTime::Month)pTime->month.ToLE(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000)); pTick->tick = datetime.GetTicks(); return CELL_OK; @@ -205,27 +206,27 @@ int cellRtcGetTick(mem_ptr_t pTime, mem_ptr_t pTic int cellRtcSetTick(mem_ptr_t pTime, mem_ptr_t pTick) { - cellRtc.Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr()); + cellRtc->Log("cellRtcSetTick(pTime=0x%x, pTick=0x%x)", pTime.GetAddr(), pTick.GetAddr()); if (!pTime.IsGood() || !pTick.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick->tick); + rDateTime date = rDateTime((time_t)pTick->tick); - pTime->year = date.GetYear(wxDateTime::TZ::UTC); - pTime->month = date.GetMonth(wxDateTime::TZ::UTC); - pTime->day = date.GetDay(wxDateTime::TZ::UTC); - pTime->hour = date.GetHour(wxDateTime::TZ::UTC); - pTime->minute = date.GetMinute(wxDateTime::TZ::UTC); - pTime->second = date.GetSecond(wxDateTime::TZ::UTC); - pTime->microsecond = date.GetMillisecond(wxDateTime::TZ::UTC) * 1000; + pTime->year = date.GetYear(rDateTime::TZ::UTC); + pTime->month = date.GetMonth(rDateTime::TZ::UTC); + pTime->day = date.GetDay(rDateTime::TZ::UTC); + pTime->hour = date.GetHour(rDateTime::TZ::UTC); + pTime->minute = date.GetMinute(rDateTime::TZ::UTC); + pTime->second = date.GetSecond(rDateTime::TZ::UTC); + pTime->microsecond = date.GetMillisecond(rDateTime::TZ::UTC) * 1000; return CELL_OK; } int cellRtcTickAddTicks(mem_ptr_t pTick0, mem_ptr_t pTick1, s64 lAdd) { - cellRtc.Log("cellRtcTickAddTicks(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); + cellRtc->Log("cellRtcTickAddTicks(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; @@ -236,13 +237,13 @@ int cellRtcTickAddTicks(mem_ptr_t pTick0, mem_ptr_t pT int cellRtcTickAddMicroseconds(mem_ptr_t pTick0, mem_ptr_t pTick1, s64 lAdd) { - cellRtc.Log("cellRtcTickAddMicroseconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); + cellRtc->Log("cellRtcTickAddMicroseconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxTimeSpan microseconds = wxTimeSpan(0, 0, 0, lAdd / 1000); + rDateTime date = rDateTime((time_t)pTick1->tick); + rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000); date.Add(microseconds); pTick0->tick = date.GetTicks(); @@ -251,13 +252,13 @@ int cellRtcTickAddMicroseconds(mem_ptr_t pTick0, mem_ptr_t pTick0, mem_ptr_t pTick1, s64 lAdd) { - cellRtc.Log("cellRtcTickAddSeconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); + cellRtc->Log("cellRtcTickAddSeconds(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxTimeSpan seconds = wxTimeSpan(0, 0, lAdd, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0); date.Add(seconds); pTick0->tick = date.GetTicks(); @@ -266,13 +267,13 @@ int cellRtcTickAddSeconds(mem_ptr_t pTick0, mem_ptr_t int cellRtcTickAddMinutes(mem_ptr_t pTick0, mem_ptr_t pTick1, s64 lAdd) { - cellRtc.Log("cellRtcTickAddMinutes(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); + cellRtc->Log("cellRtcTickAddMinutes(pTick0=0x%x, pTick1=0x%x, lAdd=%lld)", pTick0.GetAddr(), pTick1.GetAddr(), lAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxTimeSpan minutes = wxTimeSpan(0, lAdd, 0, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0); date.Add(minutes); pTick0->tick = date.GetTicks(); @@ -281,13 +282,13 @@ int cellRtcTickAddMinutes(mem_ptr_t pTick0, mem_ptr_t int cellRtcTickAddHours(mem_ptr_t pTick0, mem_ptr_t pTick1, s32 iAdd) { - cellRtc.Log("cellRtcTickAddHours(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); + cellRtc->Log("cellRtcTickAddHours(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxTimeSpan hours = wxTimeSpan(iAdd, 0, 0, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0); date.Add(hours); pTick0->tick = date.GetTicks(); @@ -296,13 +297,13 @@ int cellRtcTickAddHours(mem_ptr_t pTick0, mem_ptr_t pT int cellRtcTickAddDays(mem_ptr_t pTick0, mem_ptr_t pTick1, s32 iAdd) { - cellRtc.Log("cellRtcTickAddDays(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); + cellRtc->Log("cellRtcTickAddDays(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxDateSpan days = wxDateSpan(0, 0, 0, iAdd); + rDateTime date = rDateTime((time_t)pTick1->tick); + rDateSpan days = rDateSpan(0, 0, 0, iAdd); date.Add(days); pTick0->tick = date.GetTicks(); @@ -311,13 +312,13 @@ int cellRtcTickAddDays(mem_ptr_t pTick0, mem_ptr_t pTi int cellRtcTickAddWeeks(mem_ptr_t pTick0, mem_ptr_t pTick1, s32 iAdd) { - cellRtc.Log("cellRtcTickAddWeeks(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); + cellRtc->Log("cellRtcTickAddWeeks(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxDateSpan weeks = wxDateSpan(0, 0, iAdd, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rDateSpan weeks = rDateSpan(0, 0, iAdd, 0); date.Add(weeks); pTick0->tick = date.GetTicks(); @@ -326,13 +327,13 @@ int cellRtcTickAddWeeks(mem_ptr_t pTick0, mem_ptr_t pT int cellRtcTickAddMonths(mem_ptr_t pTick0, mem_ptr_t pTick1, s32 iAdd) { - cellRtc.Log("cellRtcTickAddMonths(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); + cellRtc->Log("cellRtcTickAddMonths(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxDateSpan months = wxDateSpan(0, iAdd, 0, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rDateSpan months = rDateSpan(0, iAdd, 0, 0); date.Add(months); pTick0->tick = date.GetTicks(); @@ -341,13 +342,13 @@ int cellRtcTickAddMonths(mem_ptr_t pTick0, mem_ptr_t p int cellRtcTickAddYears(mem_ptr_t pTick0, mem_ptr_t pTick1, s32 iAdd) { - cellRtc.Log("cellRtcTickAddYears(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); + cellRtc->Log("cellRtcTickAddYears(pTick0=0x%x, pTick1=0x%x, iAdd=%d)", pTick0.GetAddr(), pTick1.GetAddr(), iAdd); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime((time_t)pTick1->tick); - wxDateSpan years = wxDateSpan(iAdd, 0, 0, 0); + rDateTime date = rDateTime((time_t)pTick1->tick); + rDateSpan years = rDateSpan(iAdd, 0, 0, 0); date.Add(years); pTick0->tick = date.GetTicks(); @@ -356,39 +357,39 @@ int cellRtcTickAddYears(mem_ptr_t pTick0, mem_ptr_t pT int cellRtcConvertUtcToLocalTime(mem_ptr_t pUtc, mem_ptr_t pLocalTime) { - cellRtc.Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.GetAddr(), pLocalTime.GetAddr()); + cellRtc->Log("cellRtcConvertUtcToLocalTime(pUtc=0x%x, pLocalTime=0x%x)", pUtc.GetAddr(), pLocalTime.GetAddr()); if (!pUtc.IsGood() || !pLocalTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime time = wxDateTime((time_t)pUtc->tick); - wxDateTime local_time = time.FromUTC(false); + rDateTime time = rDateTime((time_t)pUtc->tick); + rDateTime local_time = time.FromUTC(false); pLocalTime->tick = local_time.GetTicks(); return CELL_OK; } int cellRtcConvertLocalTimeToUtc(mem_ptr_t pLocalTime, mem_ptr_t pUtc) { - cellRtc.Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.GetAddr(), pUtc.GetAddr()); + cellRtc->Log("cellRtcConvertLocalTimeToUtc(pLocalTime=0x%x, pUtc=0x%x)", pLocalTime.GetAddr(), pUtc.GetAddr()); if (!pLocalTime.IsGood() || !pUtc.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime time = wxDateTime((time_t)pLocalTime->tick); - wxDateTime utc_time = time.ToUTC(false); + rDateTime time = rDateTime((time_t)pLocalTime->tick); + rDateTime utc_time = time.ToUTC(false); pUtc->tick = utc_time.GetTicks(); return CELL_OK; } int cellRtcGetDosTime(mem_ptr_t pDateTime, mem32_t puiDosTime) { - cellRtc.Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.GetAddr(), puiDosTime.GetAddr()); + cellRtc->Log("cellRtcGetDosTime(pDateTime=0x%x, puiDosTime=0x%x)", pDateTime.GetAddr(), puiDosTime.GetAddr()); if (!pDateTime.IsGood() || !puiDosTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; // Convert to DOS time. - wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); puiDosTime = date_time.GetAsDOS(); return CELL_OK; @@ -396,123 +397,123 @@ int cellRtcGetDosTime(mem_ptr_t pDateTime, mem32_t puiDosTime) int cellRtcGetTime_t(mem_ptr_t pDateTime, mem64_t piTime) { - cellRtc.Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.GetAddr(), piTime.GetAddr()); + cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.GetAddr(), piTime.GetAddr()); if (!pDateTime.IsGood() || !piTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; // Convert to POSIX time_t. - wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); - piTime = convertToUNIXTime(date_time.GetSecond(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), - date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); + rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + piTime = convertToUNIXTime(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC), + date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC)); return CELL_OK; } int cellRtcGetWin32FileTime(mem_ptr_t pDateTime, mem64_t pulWin32FileTime) { - cellRtc.Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.GetAddr(), pulWin32FileTime.GetAddr()); + cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.GetAddr(), pulWin32FileTime.GetAddr()); if (!pDateTime.IsGood() || !pulWin32FileTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; // Convert to WIN32 FILETIME. - wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); - pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), - date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); + rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC), + date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC)); return CELL_OK; } int cellRtcSetDosTime(mem_ptr_t pDateTime, u32 uiDosTime) { - cellRtc.Log("cellRtcSetDosTime(pDateTime=0x%x, uiDosTime=0x%x)", pDateTime.GetAddr(), uiDosTime); + cellRtc->Log("cellRtcSetDosTime(pDateTime=0x%x, uiDosTime=0x%x)", pDateTime.GetAddr(), uiDosTime); if (!pDateTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date_time; - wxDateTime dos_time = date_time.SetFromDOS(uiDosTime); + rDateTime date_time; + rDateTime dos_time = date_time.SetFromDOS(uiDosTime); - pDateTime->year = dos_time.GetYear(wxDateTime::TZ::UTC); - pDateTime->month = dos_time.GetMonth(wxDateTime::TZ::UTC); - pDateTime->day = dos_time.GetDay(wxDateTime::TZ::UTC); - pDateTime->hour = dos_time.GetHour(wxDateTime::TZ::UTC); - pDateTime->minute = dos_time.GetMinute(wxDateTime::TZ::UTC); - pDateTime->second = dos_time.GetSecond(wxDateTime::TZ::UTC); - pDateTime->microsecond = dos_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; + pDateTime->year = dos_time.GetYear(rDateTime::TZ::UTC); + pDateTime->month = dos_time.GetMonth(rDateTime::TZ::UTC); + pDateTime->day = dos_time.GetDay(rDateTime::TZ::UTC); + pDateTime->hour = dos_time.GetHour(rDateTime::TZ::UTC); + pDateTime->minute = dos_time.GetMinute(rDateTime::TZ::UTC); + pDateTime->second = dos_time.GetSecond(rDateTime::TZ::UTC); + pDateTime->microsecond = dos_time.GetMillisecond(rDateTime::TZ::UTC) * 1000; return CELL_OK; } int cellRtcSetTime_t(mem_ptr_t pDateTime, u64 iTime) { - cellRtc.Log("cellRtcSetTime_t(pDateTime=0x%x, iTime=0x%llx)", pDateTime.GetAddr(), iTime); + cellRtc->Log("cellRtcSetTime_t(pDateTime=0x%x, iTime=0x%llx)", pDateTime.GetAddr(), iTime); if (!pDateTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date_time = wxDateTime((time_t)iTime); + rDateTime date_time = rDateTime((time_t)iTime); - pDateTime->year = date_time.GetYear(wxDateTime::TZ::UTC); - pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); - pDateTime->day = date_time.GetDay(wxDateTime::TZ::UTC); - pDateTime->hour = date_time.GetHour(wxDateTime::TZ::UTC); - pDateTime->minute = date_time.GetMinute(wxDateTime::TZ::UTC); - pDateTime->second = date_time.GetSecond(wxDateTime::TZ::UTC); - pDateTime->microsecond = date_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; + pDateTime->year = date_time.GetYear(rDateTime::TZ::UTC); + pDateTime->month = date_time.GetMonth(rDateTime::TZ::UTC); + pDateTime->day = date_time.GetDay(rDateTime::TZ::UTC); + pDateTime->hour = date_time.GetHour(rDateTime::TZ::UTC); + pDateTime->minute = date_time.GetMinute(rDateTime::TZ::UTC); + pDateTime->second = date_time.GetSecond(rDateTime::TZ::UTC); + pDateTime->microsecond = date_time.GetMillisecond(rDateTime::TZ::UTC) * 1000; return CELL_OK; } int cellRtcSetWin32FileTime(mem_ptr_t pDateTime, u64 ulWin32FileTime) { - cellRtc.Log("cellRtcSetWin32FileTime(pDateTime=0x%x, ulWin32FileTime=0x%llx)", pDateTime, ulWin32FileTime); + cellRtc->Log("cellRtcSetWin32FileTime(pDateTime=0x%x, ulWin32FileTime=0x%llx)", pDateTime, ulWin32FileTime); if (!pDateTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date_time = wxDateTime((time_t)ulWin32FileTime); + rDateTime date_time = rDateTime((time_t)ulWin32FileTime); - pDateTime->year = date_time.GetYear(wxDateTime::TZ::UTC); - pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); - pDateTime->day = date_time.GetDay(wxDateTime::TZ::UTC); - pDateTime->hour = date_time.GetHour(wxDateTime::TZ::UTC); - pDateTime->minute = date_time.GetMinute(wxDateTime::TZ::UTC); - pDateTime->second = date_time.GetSecond(wxDateTime::TZ::UTC); - pDateTime->microsecond = date_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; + pDateTime->year = date_time.GetYear(rDateTime::TZ::UTC); + pDateTime->month = date_time.GetMonth(rDateTime::TZ::UTC); + pDateTime->day = date_time.GetDay(rDateTime::TZ::UTC); + pDateTime->hour = date_time.GetHour(rDateTime::TZ::UTC); + pDateTime->minute = date_time.GetMinute(rDateTime::TZ::UTC); + pDateTime->second = date_time.GetSecond(rDateTime::TZ::UTC); + pDateTime->microsecond = date_time.GetMillisecond(rDateTime::TZ::UTC) * 1000; return CELL_OK; } int cellRtcIsLeapYear(s32 year) { - cellRtc.Log("cellRtcIsLeapYear(year=%d)", year); + cellRtc->Log("cellRtcIsLeapYear(year=%d)", year); - wxDateTime datetime; - return datetime.IsLeapYear(year, wxDateTime::Gregorian); + rDateTime datetime; + return datetime.IsLeapYear(year, rDateTime::Gregorian); } int cellRtcGetDaysInMonth(s32 year, s32 month) { - cellRtc.Log("cellRtcGetDaysInMonth(year=%d, month=%d)", year, month); + cellRtc->Log("cellRtcGetDaysInMonth(year=%d, month=%d)", year, month); - wxDateTime datetime; - return datetime.GetNumberOfDays((wxDateTime::Month) month, year, wxDateTime::Gregorian); + rDateTime datetime; + return datetime.GetNumberOfDays((rDateTime::Month) month, year, rDateTime::Gregorian); } int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day) { - cellRtc.Log("cellRtcGetDayOfWeek(year=%d, month=%d, day=%d)", year, month, day); + cellRtc->Log("cellRtcGetDayOfWeek(year=%d, month=%d, day=%d)", year, month, day); - wxDateTime datetime; - datetime.SetToWeekDay((wxDateTime::WeekDay) day, 1, (wxDateTime::Month) month, year); + rDateTime datetime; + datetime.SetToWeekDay((rDateTime::WeekDay) day, 1, (rDateTime::Month) month, year); return datetime.GetWeekDay(); } int cellRtcCheckValid(mem_ptr_t pTime) { - cellRtc.Log("cellRtcCheckValid(pTime=0x%x)", pTime.GetAddr()); + cellRtc->Log("cellRtcCheckValid(pTime=0x%x)", pTime.GetAddr()); if (!pTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; @@ -529,7 +530,7 @@ int cellRtcCheckValid(mem_ptr_t pTime) int cellRtcCompareTick(mem_ptr_t pTick0, mem_ptr_t pTick1) { - cellRtc.Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.GetAddr(), pTick1.GetAddr()); + cellRtc->Log("cellRtcCompareTick(pTick0=0x%x, pTick1=0x%x)", pTick0.GetAddr(), pTick1.GetAddr()); if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; @@ -541,44 +542,44 @@ int cellRtcCompareTick(mem_ptr_t pTick0, mem_ptr_t pTi void cellRtc_init() { - cellRtc.AddFunc(0x9dafc0d9, cellRtcGetCurrentTick); - cellRtc.AddFunc(0x32c941cf, cellRtcGetCurrentClock); - cellRtc.AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime); + cellRtc->AddFunc(0x9dafc0d9, cellRtcGetCurrentTick); + cellRtc->AddFunc(0x32c941cf, cellRtcGetCurrentClock); + cellRtc->AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime); - cellRtc.AddFunc(0x5491b9d5, cellRtcFormatRfc2822); - cellRtc.AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime); - cellRtc.AddFunc(0xd9c0b463, cellRtcFormatRfc3339); - cellRtc.AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime); - cellRtc.AddFunc(0xc5bc0fac, cellRtcParseDateTime); - cellRtc.AddFunc(0xcf11c3d6, cellRtcParseRfc3339); + cellRtc->AddFunc(0x5491b9d5, cellRtcFormatRfc2822); + cellRtc->AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime); + cellRtc->AddFunc(0xd9c0b463, cellRtcFormatRfc3339); + cellRtc->AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime); + cellRtc->AddFunc(0xc5bc0fac, cellRtcParseDateTime); + cellRtc->AddFunc(0xcf11c3d6, cellRtcParseRfc3339); - cellRtc.AddFunc(0xc7bdb7eb, cellRtcGetTick); - cellRtc.AddFunc(0x99b13034, cellRtcSetTick); - cellRtc.AddFunc(0x269a1882, cellRtcTickAddTicks); - cellRtc.AddFunc(0xf8509925, cellRtcTickAddMicroseconds); - cellRtc.AddFunc(0xccce71bd, cellRtcTickAddSeconds); - cellRtc.AddFunc(0x2f010bfa, cellRtcTickAddMinutes); - cellRtc.AddFunc(0xd41d3bd2, cellRtcTickAddHours); - cellRtc.AddFunc(0x75744e2a, cellRtcTickAddDays); - cellRtc.AddFunc(0x64c63fd5, cellRtcTickAddWeeks); - cellRtc.AddFunc(0xe0ecbb45, cellRtcTickAddMonths); - cellRtc.AddFunc(0x332a74dd, cellRtcTickAddYears); - cellRtc.AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime); - cellRtc.AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc); + cellRtc->AddFunc(0xc7bdb7eb, cellRtcGetTick); + cellRtc->AddFunc(0x99b13034, cellRtcSetTick); + cellRtc->AddFunc(0x269a1882, cellRtcTickAddTicks); + cellRtc->AddFunc(0xf8509925, cellRtcTickAddMicroseconds); + cellRtc->AddFunc(0xccce71bd, cellRtcTickAddSeconds); + cellRtc->AddFunc(0x2f010bfa, cellRtcTickAddMinutes); + cellRtc->AddFunc(0xd41d3bd2, cellRtcTickAddHours); + cellRtc->AddFunc(0x75744e2a, cellRtcTickAddDays); + cellRtc->AddFunc(0x64c63fd5, cellRtcTickAddWeeks); + cellRtc->AddFunc(0xe0ecbb45, cellRtcTickAddMonths); + cellRtc->AddFunc(0x332a74dd, cellRtcTickAddYears); + cellRtc->AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime); + cellRtc->AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc); // (TODO: Time Information Manipulation Functions missing) - cellRtc.AddFunc(0xdfff32cf, cellRtcGetDosTime); - cellRtc.AddFunc(0xcb90c761, cellRtcGetTime_t); - cellRtc.AddFunc(0xe7086f05, cellRtcGetWin32FileTime); - cellRtc.AddFunc(0x9598d4b3, cellRtcSetDosTime); - cellRtc.AddFunc(0xbb543189, cellRtcSetTime_t); - cellRtc.AddFunc(0x5f68c268, cellRtcSetWin32FileTime); + cellRtc->AddFunc(0xdfff32cf, cellRtcGetDosTime); + cellRtc->AddFunc(0xcb90c761, cellRtcGetTime_t); + cellRtc->AddFunc(0xe7086f05, cellRtcGetWin32FileTime); + cellRtc->AddFunc(0x9598d4b3, cellRtcSetDosTime); + cellRtc->AddFunc(0xbb543189, cellRtcSetTime_t); + cellRtc->AddFunc(0x5f68c268, cellRtcSetWin32FileTime); - cellRtc.AddFunc(0x5316b4a8, cellRtcIsLeapYear); - cellRtc.AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth); - cellRtc.AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek); - cellRtc.AddFunc(0x7f1086e6, cellRtcCheckValid); + cellRtc->AddFunc(0x5316b4a8, cellRtcIsLeapYear); + cellRtc->AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth); + cellRtc->AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek); + cellRtc->AddFunc(0x7f1086e6, cellRtcCheckValid); - cellRtc.AddFunc(0xfb51fc61, cellRtcCompareTick); + cellRtc->AddFunc(0xfb51fc61, cellRtcCompareTick); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index ede0bfd3d2..ea3541be23 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -8,23 +8,24 @@ #include "cellSpurs.h" -void cellSpurs_init(); -Module cellSpurs(0x000a, cellSpurs_init); +//void cellSpurs_init(); +//Module cellSpurs(0x000a, cellSpurs_init); +Module *cellSpurs = nullptr; int cellSpursInitialize(mem_ptr_t spurs, int nSpus, int spuPriority, int ppuPriority, bool exitIfNoWork) { - cellSpurs.Warning("cellSpursInitialize(spurs_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", spurs.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); + cellSpurs->Warning("cellSpursInitialize(spurs_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", spurs.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursInitialize : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursInitialize : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -36,17 +37,17 @@ int cellSpursInitialize(mem_ptr_t spurs, int nSpus, int spuPriority, int cellSpursFinalize(mem_ptr_t spurs) { - cellSpurs.Warning("cellSpursFinalize(spurs_addr=0x%x)", spurs.GetAddr()); + cellSpurs->Warning("cellSpursFinalize(spurs_addr=0x%x)", spurs.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursFinalize : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursFinalize : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursFinalize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursFinalize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -57,17 +58,17 @@ int cellSpursFinalize(mem_ptr_t spurs) int cellSpursInitializeWithAttribute(mem_ptr_t spurs, const mem_ptr_t attr) { - cellSpurs.Warning("cellSpursInitializeWithAttribute(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.GetAddr(), attr.GetAddr()); + cellSpurs->Warning("cellSpursInitializeWithAttribute(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.GetAddr(), attr.GetAddr()); if ((spurs.GetAddr() % 128 != 0) || (attr.GetAddr() % 8 != 0)) { - cellSpurs.Error("cellSpursInitializeWithAttribute : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursInitializeWithAttribute : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || !attr.IsGood()) { - cellSpurs.Error("cellSpursInitializeWithAttribute : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursInitializeWithAttribute : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -78,17 +79,17 @@ int cellSpursInitializeWithAttribute(mem_ptr_t spurs, const mem_ptr_t int cellSpursInitializeWithAttribute2(mem_ptr_t spurs, const mem_ptr_t attr) { - cellSpurs.Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.GetAddr(), attr.GetAddr()); + cellSpurs->Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.GetAddr(), attr.GetAddr()); if ((spurs.GetAddr() % 128 != 0) || (attr.GetAddr() % 8 != 0)) { - cellSpurs.Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || !attr.IsGood()) { - cellSpurs.Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -99,17 +100,17 @@ int cellSpursInitializeWithAttribute2(mem_ptr_t spurs, const mem_ptr int _cellSpursAttributeInitialize(mem_ptr_t attr, int nSpus, int spuPriority, int ppuPriority, bool exitIfNoWork) { - cellSpurs.Warning("_cellSpursAttributeInitialize(attr_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", attr.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); + cellSpurs->Warning("_cellSpursAttributeInitialize(attr_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", attr.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("_cellSpursAttributeInitialize : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("_cellSpursAttributeInitialize : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood()) { - cellSpurs.Error("_cellSpursAttributeInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("_cellSpursAttributeInitialize : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -120,17 +121,17 @@ int _cellSpursAttributeInitialize(mem_ptr_t attr, int nSpus, int cellSpursAttributeSetMemoryContainerForSpuThread(mem_ptr_t attr, u32 container) { - cellSpurs.Warning("cellSpursAttributeSetMemoryContainerForSpuThread(attr_addr=0x%x, container=0x%x)", attr.GetAddr(), container); + cellSpurs->Warning("cellSpursAttributeSetMemoryContainerForSpuThread(attr_addr=0x%x, container=0x%x)", attr.GetAddr(), container); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("cellSpursAttributeSetMemoryContainerForSpuThread : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttributeSetMemoryContainerForSpuThread : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood()) { - cellSpurs.Error("cellSpursAttributeSetMemoryContainerForSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttributeSetMemoryContainerForSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -141,23 +142,23 @@ int cellSpursAttributeSetMemoryContainerForSpuThread(mem_ptr_t attr, const mem8_t prefix, u32 size) { - cellSpurs.Warning("cellSpursAttributeSetNamePrefix(attr_addr=0x%x, prefix_addr=0x%x, size=0x%x)", attr.GetAddr(), prefix.GetAddr(), size); + cellSpurs->Warning("cellSpursAttributeSetNamePrefix(attr_addr=0x%x, prefix_addr=0x%x, size=0x%x)", attr.GetAddr(), prefix.GetAddr(), size); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood() || !prefix.IsGood()) { - cellSpurs.Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } if (size > CELL_SPURS_NAME_MAX_LENGTH) { - cellSpurs.Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_INVAL"); + cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_INVAL"); return CELL_SPURS_CORE_ERROR_INVAL; } @@ -168,17 +169,17 @@ int cellSpursAttributeSetNamePrefix(mem_ptr_t attr, const me int cellSpursAttributeEnableSpuPrintfIfAvailable(mem_ptr_t attr) { - cellSpurs.Error("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.GetAddr()); + cellSpurs->Error("cellSpursAttributeEnableSpuPrintfIfAvailable(attr_addr=0x%x)", attr.GetAddr()); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("cellSpursAttributeEnableSpuPrintfIfAvailable : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttributeEnableSpuPrintfIfAvailable : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood()) { - cellSpurs.Error("cellSpursAttributeEnableSpuPrintfIfAvailable : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttributeEnableSpuPrintfIfAvailable : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -187,17 +188,17 @@ int cellSpursAttributeEnableSpuPrintfIfAvailable(mem_ptr_t a int cellSpursAttributeSetSpuThreadGroupType(mem_ptr_t attr, int type) { - cellSpurs.Warning("cellSpursAttributeSetSpuThreadGroupType(attr_addr=0x%x, type=%u)", attr.GetAddr(), type); + cellSpurs->Warning("cellSpursAttributeSetSpuThreadGroupType(attr_addr=0x%x, type=%u)", attr.GetAddr(), type); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttributeSetNamePrefix : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood()) { - cellSpurs.Error("cellSpursAttributeSetSpuThreadGroupType : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttributeSetSpuThreadGroupType : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -209,17 +210,17 @@ int cellSpursAttributeSetSpuThreadGroupType(mem_ptr_t attr, int cellSpursAttributeEnableSystemWorkload(mem_ptr_t attr, const u8 priority[CELL_SPURS_MAX_SPU], u32 maxSpu, const bool isPreemptible[CELL_SPURS_MAX_SPU]) { - cellSpurs.Error("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority[%u], maxSpu=%u, isPreemptible[%u])", attr.GetAddr(), priority, maxSpu, isPreemptible); + cellSpurs->Error("cellSpursAttributeEnableSystemWorkload(attr_addr=0x%x, priority[%u], maxSpu=%u, isPreemptible[%u])", attr.GetAddr(), priority, maxSpu, isPreemptible); if (attr.GetAddr() % 8 != 0) { - cellSpurs.Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!attr.IsGood()) { - cellSpurs.Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -227,7 +228,7 @@ int cellSpursAttributeEnableSystemWorkload(mem_ptr_t attr, c { if (priority[i] != 1 || maxSpu == 0) { - cellSpurs.Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_INVAL"); + cellSpurs->Error("cellSpursAttributeEnableSystemWorkload : CELL_SPURS_CORE_ERROR_INVAL"); return CELL_SPURS_CORE_ERROR_INVAL; } } @@ -236,17 +237,17 @@ int cellSpursAttributeEnableSystemWorkload(mem_ptr_t attr, c int cellSpursGetSpuThreadGroupId(mem_ptr_t spurs, mem32_t group) { - cellSpurs.Error("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.GetAddr(), group.GetAddr()); + cellSpurs->Error("cellSpursGetSpuThreadGroupId(spurs_addr=0x%x, group_addr=0x%x)", spurs.GetAddr(), group.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursGetSpuThreadGroupId : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursGetSpuThreadGroupId : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || group.IsGood()) { - cellSpurs.Error("cellSpursGetSpuThreadGroupId : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursGetSpuThreadGroupId : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -255,17 +256,17 @@ int cellSpursGetSpuThreadGroupId(mem_ptr_t spurs, mem32_t group) int cellSpursGetNumSpuThread(mem_ptr_t spurs, mem32_t nThreads) { - cellSpurs.Error("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), nThreads.GetAddr()); + cellSpurs->Error("cellSpursGetNumSpuThread(spurs_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), nThreads.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursGetNumSpuThread : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursGetNumSpuThread : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || nThreads.IsGood()) { - cellSpurs.Error("cellSpursGetNumSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursGetNumSpuThread : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -274,17 +275,17 @@ int cellSpursGetNumSpuThread(mem_ptr_t spurs, mem32_t nThreads) int cellSpursGetSpuThreadId(mem_ptr_t spurs, mem32_t thread, mem32_t nThreads) { - cellSpurs.Error("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr()); + cellSpurs->Error("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)", spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || !thread.IsGood() || nThreads.IsGood()) { - cellSpurs.Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursGetSpuThreadId : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -293,17 +294,17 @@ int cellSpursGetSpuThreadId(mem_ptr_t spurs, mem32_t thread, mem32_t int cellSpursSetMaxContention(mem_ptr_t spurs, u32 workloadId, u32 maxContention) { - cellSpurs.Error("cellSpursSetMaxContention(spurs_addr=0x%x, workloadId=%u, maxContention=%u)", spurs.GetAddr(), workloadId, maxContention); + cellSpurs->Error("cellSpursSetMaxContention(spurs_addr=0x%x, workloadId=%u, maxContention=%u)", spurs.GetAddr(), workloadId, maxContention); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursSetMaxContention : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursSetMaxContention : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursSetMaxContention : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursSetMaxContention : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -312,17 +313,17 @@ int cellSpursSetMaxContention(mem_ptr_t spurs, u32 workloadId, u32 ma int cellSpursSetPriorities(mem_ptr_t spurs, u32 workloadId, const u8 priorities[CELL_SPURS_MAX_SPU]) { - cellSpurs.Error("cellSpursSetPriorities(spurs_addr=0x%x, workloadId=%u, priorities[%u])", spurs.GetAddr(), workloadId, priorities); + cellSpurs->Error("cellSpursSetPriorities(spurs_addr=0x%x, workloadId=%u, priorities[%u])", spurs.GetAddr(), workloadId, priorities); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursSetPriorities : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursSetPriorities : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursSetPriorities : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursSetPriorities : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -331,17 +332,17 @@ int cellSpursSetPriorities(mem_ptr_t spurs, u32 workloadId, const u8 int cellSpursSetPriority(mem_ptr_t spurs, u32 workloadId, u32 spuId, u32 priority) { - cellSpurs.Error("cellSpursSetPriority(spurs_addr=0x%x, workloadId=%u, spuId=%u, priority=%u)", spurs.GetAddr(), workloadId, spuId, priority); + cellSpurs->Error("cellSpursSetPriority(spurs_addr=0x%x, workloadId=%u, spuId=%u, priority=%u)", spurs.GetAddr(), workloadId, spuId, priority); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursSetPriority : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursSetPriority : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursSetPriority : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursSetPriority : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -350,17 +351,17 @@ int cellSpursSetPriority(mem_ptr_t spurs, u32 workloadId, u32 spuId, int cellSpursSetPreemptionVictimHints(mem_ptr_t spurs, const bool isPreemptible[CELL_SPURS_MAX_SPU]) { - cellSpurs.Error("cellSpursSetPreemptionVictimHints(spurs_addr=0x%x, isPreemptible[%u])", spurs.GetAddr(), isPreemptible); + cellSpurs->Error("cellSpursSetPreemptionVictimHints(spurs_addr=0x%x, isPreemptible[%u])", spurs.GetAddr(), isPreemptible); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursSetPreemptionVictimHints : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursSetPreemptionVictimHints : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursSetPreemptionVictimHints : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursSetPreemptionVictimHints : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -369,17 +370,17 @@ int cellSpursSetPreemptionVictimHints(mem_ptr_t spurs, const bool isP int cellSpursAttachLv2EventQueue(mem_ptr_t spurs, u32 queue, mem8_t port, int isDynamic) { - cellSpurs.Warning("cellSpursAttachLv2EventQueue(spurs_addr=0x%x, queue=0x%x, port_addr=0x%x, isDynamic=%u)", spurs.GetAddr(), queue, port.GetAddr(), isDynamic); + cellSpurs->Warning("cellSpursAttachLv2EventQueue(spurs_addr=0x%x, queue=0x%x, port_addr=0x%x, isDynamic=%u)", spurs.GetAddr(), queue, port.GetAddr(), isDynamic); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursAttachLv2EventQueue : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursAttachLv2EventQueue : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || !port.IsGood()) { - cellSpurs.Error("cellSpursAttachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursAttachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -390,17 +391,17 @@ int cellSpursAttachLv2EventQueue(mem_ptr_t spurs, u32 queue, mem8_t p int cellSpursDetachLv2EventQueue(mem_ptr_t spurs, u8 port) { - cellSpurs.Warning("cellSpursDetachLv2EventQueue(spurs_addr=0x%x, port=0x%x)", spurs.GetAddr(), port); + cellSpurs->Warning("cellSpursDetachLv2EventQueue(spurs_addr=0x%x, port=0x%x)", spurs.GetAddr(), port); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursDetachLv2EventQueue : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursDetachLv2EventQueue : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursDetachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursDetachLv2EventQueue : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -411,17 +412,17 @@ int cellSpursDetachLv2EventQueue(mem_ptr_t spurs, u8 port) int cellSpursEnableExceptionEventHandler(mem_ptr_t spurs, bool flag) { - cellSpurs.Error("cellSpursEnableExceptionEventHandler(spurs_addr=0x%x, flag=%u)", spurs.GetAddr(), flag); + cellSpurs->Error("cellSpursEnableExceptionEventHandler(spurs_addr=0x%x, flag=%u)", spurs.GetAddr(), flag); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEnableExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEnableExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursEnableExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEnableExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -430,17 +431,17 @@ int cellSpursEnableExceptionEventHandler(mem_ptr_t spurs, bool flag) int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t spurs, mem_func_ptr_t eaHandler, mem_ptr_t arg) { - cellSpurs.Error("cellSpursSetGlobalExceptionEventHandler(spurs_addr=0x%x, eaHandler_addr=0x%x, arg_addr=0x%x,)", spurs.GetAddr(), eaHandler.GetAddr(), arg.GetAddr()); + cellSpurs->Error("cellSpursSetGlobalExceptionEventHandler(spurs_addr=0x%x, eaHandler_addr=0x%x, arg_addr=0x%x,)", spurs.GetAddr(), eaHandler.GetAddr(), arg.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursSetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursSetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || eaHandler.IsGood()) { - cellSpurs.Error("cellSpursSetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursSetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -449,17 +450,17 @@ int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t spurs, mem_func int cellSpursUnsetGlobalExceptionEventHandler(mem_ptr_t spurs) { - cellSpurs.Error("cellSpursUnsetGlobalExceptionEventHandler(spurs_addr=0x%x)", spurs.GetAddr()); + cellSpurs->Error("cellSpursUnsetGlobalExceptionEventHandler(spurs_addr=0x%x)", spurs.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursUnsetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursUnsetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood()) { - cellSpurs.Error("cellSpursUnsetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursUnsetGlobalExceptionEventHandler : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -468,17 +469,17 @@ int cellSpursUnsetGlobalExceptionEventHandler(mem_ptr_t spurs) int cellSpursGetInfo(mem_ptr_t spurs, mem_ptr_t info) { - cellSpurs.Error("cellSpursGetInfo(spurs_addr=0x%x, info_addr=0x%x)", spurs.GetAddr(), info.GetAddr()); + cellSpurs->Error("cellSpursGetInfo(spurs_addr=0x%x, info_addr=0x%x)", spurs.GetAddr(), info.GetAddr()); if (spurs.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursGetInfo : CELL_SPURS_CORE_ERROR_ALIGN"); + cellSpurs->Error("cellSpursGetInfo : CELL_SPURS_CORE_ERROR_ALIGN"); return CELL_SPURS_CORE_ERROR_ALIGN; } if (!spurs.IsGood() || !info.IsGood()) { - cellSpurs.Error("cellSpursGetInfo : CELL_SPURS_CORE_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursGetInfo : CELL_SPURS_CORE_ERROR_NULL_POINTER"); return CELL_SPURS_CORE_ERROR_NULL_POINTER; } @@ -487,17 +488,17 @@ int cellSpursGetInfo(mem_ptr_t spurs, mem_ptr_t info) int _cellSpursEventFlagInitialize(mem_ptr_t spurs, mem_ptr_t taskset, mem_ptr_t eventFlag, u32 flagClearMode, u32 flagDirection) { - cellSpurs.Warning("_cellSpursEventFlagInitialize(spurs_addr=0x%x, taskset_addr=0x%x, eventFlag_addr=0x%x, flagClearMode=%u, flagDirection=%u)", spurs.GetAddr(), taskset.GetAddr(), eventFlag.GetAddr(), flagClearMode, flagDirection); + cellSpurs->Warning("_cellSpursEventFlagInitialize(spurs_addr=0x%x, taskset_addr=0x%x, eventFlag_addr=0x%x, flagClearMode=%u, flagDirection=%u)", spurs.GetAddr(), taskset.GetAddr(), eventFlag.GetAddr(), flagClearMode, flagDirection); if ((taskset.GetAddr() % 128 != 0) || (eventFlag.GetAddr() % 128 != 0)) { - cellSpurs.Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if ((!spurs.IsGood() && !taskset.IsGood()) || !eventFlag.IsGood()) { - cellSpurs.Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -508,17 +509,17 @@ int _cellSpursEventFlagInitialize(mem_ptr_t spurs, mem_ptr_t eventFlag) { - cellSpurs.Error("cellSpursEventFlagAttachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr()); + cellSpurs->Error("cellSpursEventFlagAttachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr()); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagAttachLv2EventQueue : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagAttachLv2EventQueue : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood()) { - cellSpurs.Error("cellSpursEventFlagAttachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagAttachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -527,17 +528,17 @@ int cellSpursEventFlagAttachLv2EventQueue(mem_ptr_t eventFla int cellSpursEventFlagDetachLv2EventQueue(mem_ptr_t eventFlag) { - cellSpurs.Error("cellSpursEventFlagDetachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr()); + cellSpurs->Error("cellSpursEventFlagDetachLv2EventQueue(eventFlag_addr=0x%x)", eventFlag.GetAddr()); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagDetachLv2EventQueue : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagDetachLv2EventQueue : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood()) { - cellSpurs.Error("cellSpursEventFlagDetachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagDetachLv2EventQueue : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -546,17 +547,17 @@ int cellSpursEventFlagDetachLv2EventQueue(mem_ptr_t eventFla int cellSpursEventFlagWait(mem_ptr_t eventFlag, mem16_t mask, u32 mode) { - cellSpurs.Error("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode); + cellSpurs->Error("cellSpursEventFlagWait(eventFlag_addr=0x%x, mask=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagWait : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagWait : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood() || !mask.IsGood()) { - cellSpurs.Error("cellSpursEventFlagWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -565,17 +566,17 @@ int cellSpursEventFlagWait(mem_ptr_t eventFlag, mem16_t mask int cellSpursEventFlagClear(mem_ptr_t eventFlag, u16 bits) { - cellSpurs.Error("cellSpursEventFlagClear(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits); + cellSpurs->Error("cellSpursEventFlagClear(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagClear : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagClear : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood()) { - cellSpurs.Error("cellSpursEventFlagClear : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagClear : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -584,17 +585,17 @@ int cellSpursEventFlagClear(mem_ptr_t eventFlag, u16 bits) int cellSpursEventFlagSet(mem_ptr_t eventFlag, u16 bits) { - cellSpurs.Error("cellSpursEventFlagSet(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits); + cellSpurs->Error("cellSpursEventFlagSet(eventFlag_addr=0x%x, bits=%u)", eventFlag.GetAddr(), bits); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagSet : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagSet : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood()) { - cellSpurs.Error("cellSpursEventFlagSet : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagSet : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -603,17 +604,17 @@ int cellSpursEventFlagSet(mem_ptr_t eventFlag, u16 bits) int cellSpursEventFlagTryWait(mem_ptr_t eventFlag, mem16_t mask, u32 mode) { - cellSpurs.Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode); + cellSpurs->Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, mask_addr=0x%x, mode=%u)", eventFlag.GetAddr(), mask.GetAddr(), mode); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood()) { - cellSpurs.Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -622,17 +623,17 @@ int cellSpursEventFlagTryWait(mem_ptr_t eventFlag, mem16_t m int cellSpursEventFlagGetDirection(mem_ptr_t eventFlag, mem32_t direction) { - cellSpurs.Warning("cellSpursEventFlagGetDirection(eventFlag_addr=0x%x, direction_addr=%u)", eventFlag.GetAddr(), direction.GetAddr()); + cellSpurs->Warning("cellSpursEventFlagGetDirection(eventFlag_addr=0x%x, direction_addr=%u)", eventFlag.GetAddr(), direction.GetAddr()); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagGetDirection : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagGetDirection : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood() || !direction.IsGood()) { - cellSpurs.Error("cellSpursEventFlagGetDirection : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagGetDirection : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -643,17 +644,17 @@ int cellSpursEventFlagGetDirection(mem_ptr_t eventFlag, mem3 int cellSpursEventFlagGetClearMode(mem_ptr_t eventFlag, mem32_t clear_mode) { - cellSpurs.Warning("cellSpursEventFlagGetClearMode(eventFlag_addr=0x%x, clear_mode_addr=%u)", eventFlag.GetAddr(), clear_mode.GetAddr()); + cellSpurs->Warning("cellSpursEventFlagGetClearMode(eventFlag_addr=0x%x, clear_mode_addr=%u)", eventFlag.GetAddr(), clear_mode.GetAddr()); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagGetClearMode : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagGetClearMode : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood() || !clear_mode.IsGood()) { - cellSpurs.Error("cellSpursEventFlagGetClearMode : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagGetClearMode : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -664,17 +665,17 @@ int cellSpursEventFlagGetClearMode(mem_ptr_t eventFlag, mem3 int cellSpursEventFlagGetTasksetAddress(mem_ptr_t eventFlag, mem_ptr_t taskset) { - cellSpurs.Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, taskset_addr=0x%x)", eventFlag.GetAddr(), taskset.GetAddr()); + cellSpurs->Error("cellSpursEventFlagTryWait(eventFlag_addr=0x%x, taskset_addr=0x%x)", eventFlag.GetAddr(), taskset.GetAddr()); if (eventFlag.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!eventFlag.IsGood() || !taskset.IsGood()) { - cellSpurs.Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursEventFlagTryWait : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -945,17 +946,17 @@ int cellSpursCreateTasksetWithAttribute() int cellSpursCreateTaskset(mem_ptr_t spurs, mem_ptr_t taskset, u64 args, mem8_t priority, u32 maxContention) { - cellSpurs.Error("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%x, priority_addr=0x%x, maxContention=%u)", spurs.GetAddr(), taskset.GetAddr(), args, priority.GetAddr(), maxContention); + cellSpurs->Error("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%x, priority_addr=0x%x, maxContention=%u)", spurs.GetAddr(), taskset.GetAddr(), args, priority.GetAddr(), maxContention); if ((spurs.GetAddr() % 128 != 0) || (taskset.GetAddr() % 128 != 0)) { - cellSpurs.Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!spurs.IsGood() || !taskset.IsGood()) { - cellSpurs.Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -967,17 +968,17 @@ int cellSpursCreateTaskset(mem_ptr_t spurs, mem_ptr_t taskset) { - cellSpurs.Error("cellSpursJoinTaskset(taskset_addr=0x%x)", taskset.GetAddr()); + cellSpurs->Error("cellSpursJoinTaskset(taskset_addr=0x%x)", taskset.GetAddr()); if (taskset.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursJoinTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursJoinTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!taskset.IsGood()) { - cellSpurs.Error("cellSpursJoinTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursJoinTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -986,17 +987,17 @@ int cellSpursJoinTaskset(mem_ptr_t taskset) int cellSpursGetTasksetId(mem_ptr_t taskset, mem32_t workloadId) { - cellSpurs.Error("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.GetAddr(), workloadId.GetAddr()); + cellSpurs->Error("cellSpursGetTasksetId(taskset_addr=0x%x, workloadId_addr=0x%x)", taskset.GetAddr(), workloadId.GetAddr()); if (taskset.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursGetTasksetId : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursGetTasksetId : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!taskset.IsGood() || !workloadId.IsGood()) { - cellSpurs.Error("cellSpursGetTasksetId : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursGetTasksetId : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -1005,17 +1006,17 @@ int cellSpursGetTasksetId(mem_ptr_t taskset, mem32_t workloadI int cellSpursShutdownTaskset(mem_ptr_t taskset) { - cellSpurs.Error("cellSpursShutdownTaskset(taskset_addr=0x%x)", taskset.GetAddr()); + cellSpurs->Error("cellSpursShutdownTaskset(taskset_addr=0x%x)", taskset.GetAddr()); if (taskset.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursShutdownTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursShutdownTaskset : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!taskset.IsGood()) { - cellSpurs.Error("cellSpursShutdownTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursShutdownTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -1026,18 +1027,18 @@ int cellSpursCreateTask(mem_ptr_t taskset, mem32_t taskID, mem mem_ptr_t context_addr, u32 context_size, mem_ptr_t lsPattern, mem_ptr_t argument) { - cellSpurs.Error("cellSpursCreateTask(taskset_addr=0x%x, taskID_addr=0x%x, elf_addr_addr=0x%x, context_addr_addr=0x%x, context_size=%u, lsPattern_addr=0x%x, argument_addr=0x%x)", + cellSpurs->Error("cellSpursCreateTask(taskset_addr=0x%x, taskID_addr=0x%x, elf_addr_addr=0x%x, context_addr_addr=0x%x, context_size=%u, lsPattern_addr=0x%x, argument_addr=0x%x)", taskset.GetAddr(), taskID.GetAddr(), elf_addr.GetAddr(), context_addr.GetAddr(), context_size, lsPattern.GetAddr(), argument.GetAddr()); if (taskset.GetAddr() % 128 != 0) { - cellSpurs.Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!taskset.IsGood()) { - cellSpurs.Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -1046,17 +1047,17 @@ int cellSpursCreateTask(mem_ptr_t taskset, mem32_t taskID, mem int _cellSpursSendSignal(mem_ptr_t taskset, u32 taskID) { - cellSpurs.Error("_cellSpursSendSignal(taskset_addr=0x%x, taskID=%u)", taskset.GetAddr(), taskID); + cellSpurs->Error("_cellSpursSendSignal(taskset_addr=0x%x, taskID=%u)", taskset.GetAddr(), taskID); if (taskset.GetAddr() % 128 != 0) { - cellSpurs.Error("_cellSpursSendSignal : CELL_SPURS_TASK_ERROR_ALIGN"); + cellSpurs->Error("_cellSpursSendSignal : CELL_SPURS_TASK_ERROR_ALIGN"); return CELL_SPURS_TASK_ERROR_ALIGN; } if (!taskset.IsGood()) { - cellSpurs.Error("_cellSpursSendSignal : CELL_SPURS_TASK_ERROR_NULL_POINTER"); + cellSpurs->Error("_cellSpursSendSignal : CELL_SPURS_TASK_ERROR_NULL_POINTER"); return CELL_SPURS_TASK_ERROR_NULL_POINTER; } @@ -1270,132 +1271,133 @@ int cellSpursJobChainGetError() void cellSpurs_init() { // Core - cellSpurs.AddFunc(0xacfc8dbc, cellSpursInitialize); - cellSpurs.AddFunc(0xaa6269a8, cellSpursInitializeWithAttribute); - cellSpurs.AddFunc(0x30aa96c4, cellSpursInitializeWithAttribute2); - cellSpurs.AddFunc(0xca4c4600, cellSpursFinalize); - cellSpurs.AddFunc(0x95180230, _cellSpursAttributeInitialize); - cellSpurs.AddFunc(0x82275c1c, cellSpursAttributeSetMemoryContainerForSpuThread); - cellSpurs.AddFunc(0x07529113, cellSpursAttributeSetNamePrefix); - cellSpurs.AddFunc(0x1051d134, cellSpursAttributeEnableSpuPrintfIfAvailable); - cellSpurs.AddFunc(0xa839a4d9, cellSpursAttributeSetSpuThreadGroupType); - cellSpurs.AddFunc(0x9dcbcb5d, cellSpursAttributeEnableSystemWorkload); - cellSpurs.AddFunc(0x39c173fb, cellSpursGetSpuThreadGroupId); - cellSpurs.AddFunc(0xc56defb5, cellSpursGetNumSpuThread); - cellSpurs.AddFunc(0x6c960f6d, cellSpursGetSpuThreadId); - cellSpurs.AddFunc(0x1f402f8f, cellSpursGetInfo); - cellSpurs.AddFunc(0x84d2f6d5, cellSpursSetMaxContention); - cellSpurs.AddFunc(0x80a29e27, cellSpursSetPriorities); - // cellSpurs.AddFunc(, cellSpursSetPriority); - cellSpurs.AddFunc(0x4de203e2, cellSpursSetPreemptionVictimHints); - cellSpurs.AddFunc(0xb9bc6207, cellSpursAttachLv2EventQueue); - cellSpurs.AddFunc(0x4e66d483, cellSpursDetachLv2EventQueue); - cellSpurs.AddFunc(0x32b94add, cellSpursEnableExceptionEventHandler); - cellSpurs.AddFunc(0x7517724a, cellSpursSetGlobalExceptionEventHandler); - cellSpurs.AddFunc(0x861237f8, cellSpursUnsetGlobalExceptionEventHandler); + cellSpurs->AddFunc(0xacfc8dbc, cellSpursInitialize); + cellSpurs->AddFunc(0xaa6269a8, cellSpursInitializeWithAttribute); + cellSpurs->AddFunc(0x30aa96c4, cellSpursInitializeWithAttribute2); + cellSpurs->AddFunc(0xca4c4600, cellSpursFinalize); + cellSpurs->AddFunc(0x95180230, _cellSpursAttributeInitialize); + cellSpurs->AddFunc(0x82275c1c, cellSpursAttributeSetMemoryContainerForSpuThread); + cellSpurs->AddFunc(0x07529113, cellSpursAttributeSetNamePrefix); + cellSpurs->AddFunc(0x1051d134, cellSpursAttributeEnableSpuPrintfIfAvailable); + cellSpurs->AddFunc(0xa839a4d9, cellSpursAttributeSetSpuThreadGroupType); + cellSpurs->AddFunc(0x9dcbcb5d, cellSpursAttributeEnableSystemWorkload); + cellSpurs->AddFunc(0x39c173fb, cellSpursGetSpuThreadGroupId); + cellSpurs->AddFunc(0xc56defb5, cellSpursGetNumSpuThread); + cellSpurs->AddFunc(0x6c960f6d, cellSpursGetSpuThreadId); + cellSpurs->AddFunc(0x1f402f8f, cellSpursGetInfo); + cellSpurs->AddFunc(0x84d2f6d5, cellSpursSetMaxContention); + cellSpurs->AddFunc(0x80a29e27, cellSpursSetPriorities); + // cellSpurs->AddFunc(, cellSpursSetPriority); + cellSpurs->AddFunc(0x4de203e2, cellSpursSetPreemptionVictimHints); + cellSpurs->AddFunc(0xb9bc6207, cellSpursAttachLv2EventQueue); + cellSpurs->AddFunc(0x4e66d483, cellSpursDetachLv2EventQueue); + cellSpurs->AddFunc(0x32b94add, cellSpursEnableExceptionEventHandler); + cellSpurs->AddFunc(0x7517724a, cellSpursSetGlobalExceptionEventHandler); + cellSpurs->AddFunc(0x861237f8, cellSpursUnsetGlobalExceptionEventHandler); // Event flag - cellSpurs.AddFunc(0x5ef96465, _cellSpursEventFlagInitialize); - cellSpurs.AddFunc(0x87630976, cellSpursEventFlagAttachLv2EventQueue); - cellSpurs.AddFunc(0x22aab31d, cellSpursEventFlagDetachLv2EventQueue); - cellSpurs.AddFunc(0x373523d4, cellSpursEventFlagWait); - cellSpurs.AddFunc(0x4ac7bae4, cellSpursEventFlagClear); - cellSpurs.AddFunc(0xf5507729, cellSpursEventFlagSet); - cellSpurs.AddFunc(0x6d2d9339, cellSpursEventFlagTryWait); - cellSpurs.AddFunc(0x890f9e5a, cellSpursEventFlagGetDirection); - cellSpurs.AddFunc(0x4d1e9373, cellSpursEventFlagGetClearMode); - cellSpurs.AddFunc(0x947efb0b, cellSpursEventFlagGetTasksetAddress); + cellSpurs->AddFunc(0x5ef96465, _cellSpursEventFlagInitialize); + cellSpurs->AddFunc(0x87630976, cellSpursEventFlagAttachLv2EventQueue); + cellSpurs->AddFunc(0x22aab31d, cellSpursEventFlagDetachLv2EventQueue); + cellSpurs->AddFunc(0x373523d4, cellSpursEventFlagWait); + cellSpurs->AddFunc(0x4ac7bae4, cellSpursEventFlagClear); + cellSpurs->AddFunc(0xf5507729, cellSpursEventFlagSet); + cellSpurs->AddFunc(0x6d2d9339, cellSpursEventFlagTryWait); + cellSpurs->AddFunc(0x890f9e5a, cellSpursEventFlagGetDirection); + cellSpurs->AddFunc(0x4d1e9373, cellSpursEventFlagGetClearMode); + cellSpurs->AddFunc(0x947efb0b, cellSpursEventFlagGetTasksetAddress); // Taskset - cellSpurs.AddFunc(0x52cc6c82, cellSpursCreateTaskset); - cellSpurs.AddFunc(0xc10931cb, cellSpursCreateTasksetWithAttribute); - cellSpurs.AddFunc(0x16394a4e, _cellSpursTasksetAttributeInitialize); - cellSpurs.AddFunc(0xc2acdf43, _cellSpursTasksetAttribute2Initialize); - cellSpurs.AddFunc(0x652b70e2, cellSpursTasksetAttributeSetName); - cellSpurs.AddFunc(0x9f72add3, cellSpursJoinTaskset); - cellSpurs.AddFunc(0xe7dd87e1, cellSpursGetTasksetId); - cellSpurs.AddFunc(0xa789e631, cellSpursShutdownTaskset); - cellSpurs.AddFunc(0xbeb600ac, cellSpursCreateTask); - cellSpurs.AddFunc(0x1d46fedf, cellSpursCreateTaskWithAttribute); - cellSpurs.AddFunc(0xb8474eff, cellSpursTaskAttributeInitialize); - cellSpurs.AddFunc(0x8adadf65, _cellSpursTaskAttribute2Initialize); - cellSpurs.AddFunc(0xa121a224, cellSpursTaskAttributeSetExitCodeContainer); - cellSpurs.AddFunc(0x13ae18f3, cellSpursTaskExitCodeGet); - cellSpurs.AddFunc(0x34552fa6, cellSpursTaskExitCodeInitialize); - cellSpurs.AddFunc(0xe717ac73, cellSpursTaskExitCodeTryGet); - cellSpurs.AddFunc(0x1d344406, cellSpursTaskGetLoadableSegmentPattern); - cellSpurs.AddFunc(0x7cb33c2e, cellSpursTaskGetReadOnlyAreaPattern); - cellSpurs.AddFunc(0x9197915f, cellSpursTaskGenerateLsPattern); - cellSpurs.AddFunc(0x9034e538, cellSpursTaskGetContextSaveAreaSize); - cellSpurs.AddFunc(0xe0a6dbe4, _cellSpursSendSignal); - cellSpurs.AddFunc(0x4a6465e3, cellSpursCreateTaskset2); - cellSpurs.AddFunc(0xe14ca62d, cellSpursCreateTask2); - cellSpurs.AddFunc(0xa7a94892, cellSpursJoinTask2); - cellSpurs.AddFunc(0x838fa4f0, cellSpursTryJoinTask2); - cellSpurs.AddFunc(0x1ebcf459, cellSpursDestroyTaskset2); - cellSpurs.AddFunc(0xe4944a1c, cellSpursCreateTask2WithBinInfo); - cellSpurs.AddFunc(0x4cce88a9, cellSpursLookUpTasksetAddress); - cellSpurs.AddFunc(0x58d58fcf, cellSpursTasksetGetSpursAddress); - cellSpurs.AddFunc(0xd2e23fa9, cellSpurssetExceptionEventHandler); - cellSpurs.AddFunc(0x4c75deb8, cellSpursUnsetExceptionEventHandler); - cellSpurs.AddFunc(0x9fcb567b, cellSpursGetTasksetInfo); + cellSpurs->AddFunc(0x52cc6c82, cellSpursCreateTaskset); + cellSpurs->AddFunc(0xc10931cb, cellSpursCreateTasksetWithAttribute); + cellSpurs->AddFunc(0x16394a4e, _cellSpursTasksetAttributeInitialize); + cellSpurs->AddFunc(0xc2acdf43, _cellSpursTasksetAttribute2Initialize); + cellSpurs->AddFunc(0x652b70e2, cellSpursTasksetAttributeSetName); + cellSpurs->AddFunc(0x9f72add3, cellSpursJoinTaskset); + cellSpurs->AddFunc(0xe7dd87e1, cellSpursGetTasksetId); + cellSpurs->AddFunc(0xa789e631, cellSpursShutdownTaskset); + cellSpurs->AddFunc(0xbeb600ac, cellSpursCreateTask); + cellSpurs->AddFunc(0x1d46fedf, cellSpursCreateTaskWithAttribute); + cellSpurs->AddFunc(0xb8474eff, cellSpursTaskAttributeInitialize); + cellSpurs->AddFunc(0x8adadf65, _cellSpursTaskAttribute2Initialize); + cellSpurs->AddFunc(0xa121a224, cellSpursTaskAttributeSetExitCodeContainer); + cellSpurs->AddFunc(0x13ae18f3, cellSpursTaskExitCodeGet); + cellSpurs->AddFunc(0x34552fa6, cellSpursTaskExitCodeInitialize); + cellSpurs->AddFunc(0xe717ac73, cellSpursTaskExitCodeTryGet); + cellSpurs->AddFunc(0x1d344406, cellSpursTaskGetLoadableSegmentPattern); + cellSpurs->AddFunc(0x7cb33c2e, cellSpursTaskGetReadOnlyAreaPattern); + cellSpurs->AddFunc(0x9197915f, cellSpursTaskGenerateLsPattern); + cellSpurs->AddFunc(0x9034e538, cellSpursTaskGetContextSaveAreaSize); + cellSpurs->AddFunc(0xe0a6dbe4, _cellSpursSendSignal); + cellSpurs->AddFunc(0x4a6465e3, cellSpursCreateTaskset2); + cellSpurs->AddFunc(0xe14ca62d, cellSpursCreateTask2); + cellSpurs->AddFunc(0xa7a94892, cellSpursJoinTask2); + cellSpurs->AddFunc(0x838fa4f0, cellSpursTryJoinTask2); + cellSpurs->AddFunc(0x1ebcf459, cellSpursDestroyTaskset2); + cellSpurs->AddFunc(0xe4944a1c, cellSpursCreateTask2WithBinInfo); + cellSpurs->AddFunc(0x4cce88a9, cellSpursLookUpTasksetAddress); + cellSpurs->AddFunc(0x58d58fcf, cellSpursTasksetGetSpursAddress); + cellSpurs->AddFunc(0xd2e23fa9, cellSpurssetExceptionEventHandler); + cellSpurs->AddFunc(0x4c75deb8, cellSpursUnsetExceptionEventHandler); + cellSpurs->AddFunc(0x9fcb567b, cellSpursGetTasksetInfo); // Job Chain - cellSpurs.AddFunc(0x60eb2dec, cellSpursCreateJobChain); - cellSpurs.AddFunc(0x303c19cd, cellSpursCreateJobChainWithAttribute); - cellSpurs.AddFunc(0x738e40e6, cellSpursShutdownJobChain); - cellSpurs.AddFunc(0xa7c066de, cellSpursJoinJobChain); - cellSpurs.AddFunc(0xbfea60fa, cellSpursKickJobChain); - cellSpurs.AddFunc(0xf31731bb, cellSpursRunJobChain); - cellSpurs.AddFunc(0x161da6a7, cellSpursJobChainGetError); - cellSpurs.AddFunc(0x3548f483, _cellSpursJobChainAttributeInitialize); - cellSpurs.AddFunc(0x9fef70c2, cellSpursJobChainAttributeSetName); - cellSpurs.AddFunc(0xbb68d76e, cellSpursJobChainAttributeSetHaltOnError); - cellSpurs.AddFunc(0x2cfccb99, cellSpursJobChainAttributesetJobTypeMemoryCheck); + cellSpurs->AddFunc(0x60eb2dec, cellSpursCreateJobChain); + cellSpurs->AddFunc(0x303c19cd, cellSpursCreateJobChainWithAttribute); + cellSpurs->AddFunc(0x738e40e6, cellSpursShutdownJobChain); + cellSpurs->AddFunc(0xa7c066de, cellSpursJoinJobChain); + cellSpurs->AddFunc(0xbfea60fa, cellSpursKickJobChain); + cellSpurs->AddFunc(0xf31731bb, cellSpursRunJobChain); + cellSpurs->AddFunc(0x161da6a7, cellSpursJobChainGetError); + cellSpurs->AddFunc(0x3548f483, _cellSpursJobChainAttributeInitialize); + cellSpurs->AddFunc(0x9fef70c2, cellSpursJobChainAttributeSetName); + cellSpurs->AddFunc(0xbb68d76e, cellSpursJobChainAttributeSetHaltOnError); + cellSpurs->AddFunc(0x2cfccb99, cellSpursJobChainAttributesetJobTypeMemoryCheck); // Job Guard - cellSpurs.AddFunc(0x68aaeba9, cellSpursJobGuardInitialize); - cellSpurs.AddFunc(0xd5d0b256, cellSpursJobGuardNotify); - cellSpurs.AddFunc(0x00af2519, cellSpursJobGuardReset); + cellSpurs->AddFunc(0x68aaeba9, cellSpursJobGuardInitialize); + cellSpurs->AddFunc(0xd5d0b256, cellSpursJobGuardNotify); + cellSpurs->AddFunc(0x00af2519, cellSpursJobGuardReset); // Queue/LFQueue - cellSpurs.AddFunc(0x011ee38b, _cellSpursLFQueueInitialize); - cellSpurs.AddFunc(0x8a85674d, _cellSpursLFQueuePushBody); - cellSpurs.AddFunc(0x1656d49f, cellSpursLFQueueAttachLv2EventQueue); - cellSpurs.AddFunc(0x73e06f91, cellSpursLFQueueDetachLv2EventQueue); - cellSpurs.AddFunc(0x082bfb09, _cellSpursQueueInitialize); - cellSpurs.AddFunc(0x91066667, cellSpursQueuePopBody); - cellSpurs.AddFunc(0x92cff6ed, cellSpursQueuePushBody); - cellSpurs.AddFunc(0xe5443be7, cellSpursQueueAttachLv2EventQueue); - cellSpurs.AddFunc(0x039d70b7, cellSpursQueueDetachLv2EventQueue); - cellSpurs.AddFunc(0x35dae22b, _cellSpursLFQueuePopBody); - cellSpurs.AddFunc(0xb792ca1a, cellSpursLFQueueGetTasksetAddress); - cellSpurs.AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize); - cellSpurs.AddFunc(0x167ea63e, cellSyncLFQueueSize); - cellSpurs.AddFunc(0x2af0c515, cellSyncLFQueueClear); - cellSpurs.AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2); - cellSpurs.AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2); - cellSpurs.AddFunc(0x48154c9b, cellSyncQueuePeek); - cellSpurs.AddFunc(0x4da349b2, cellSyncQueueSize); - cellSpurs.AddFunc(0x4da6d7e0, cellSyncQueuePop); - cellSpurs.AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer); - cellSpurs.AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue); - cellSpurs.AddFunc(0x5ae841e5, cellSyncQueuePush); - cellSpurs.AddFunc(0x68af923c, cellSyncQueueTryPeek); - cellSpurs.AddFunc(0x6bb4ef9d,_cellSyncLFQueueGetPushPointer2); - cellSpurs.AddFunc(0x705985cd, cellSyncQueueTryPush); - cellSpurs.AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer); - cellSpurs.AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2); - cellSpurs.AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue); - cellSpurs.AddFunc(0xa5362e73, cellSyncQueueClear); - cellSpurs.AddFunc(0xa58df87f, cellSyncQueueTryPop); - cellSpurs.AddFunc(0xaa355278, cellSyncLFQueueInitialize); - cellSpurs.AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress); - cellSpurs.AddFunc(0xba5961ca, _cellSyncLFQueuePushBody); - cellSpurs.AddFunc(0xd59aa307, cellSyncLFQueueGetDirection); - cellSpurs.AddFunc(0xe18c273c, cellSyncLFQueueDepth); - cellSpurs.AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody); - cellSpurs.AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer); - cellSpurs.AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer); + cellSpurs->AddFunc(0x011ee38b, _cellSpursLFQueueInitialize); + cellSpurs->AddFunc(0x8a85674d, _cellSpursLFQueuePushBody); + cellSpurs->AddFunc(0x1656d49f, cellSpursLFQueueAttachLv2EventQueue); + cellSpurs->AddFunc(0x73e06f91, cellSpursLFQueueDetachLv2EventQueue); + cellSpurs->AddFunc(0x082bfb09, _cellSpursQueueInitialize); + cellSpurs->AddFunc(0x91066667, cellSpursQueuePopBody); + cellSpurs->AddFunc(0x92cff6ed, cellSpursQueuePushBody); + cellSpurs->AddFunc(0xe5443be7, cellSpursQueueAttachLv2EventQueue); + cellSpurs->AddFunc(0x039d70b7, cellSpursQueueDetachLv2EventQueue); + cellSpurs->AddFunc(0x35dae22b, _cellSpursLFQueuePopBody); + cellSpurs->AddFunc(0xb792ca1a, cellSpursLFQueueGetTasksetAddress); + cellSpurs->AddFunc(0x0c7cb9f7, cellSyncLFQueueGetEntrySize); + cellSpurs->AddFunc(0x167ea63e, cellSyncLFQueueSize); + cellSpurs->AddFunc(0x2af0c515, cellSyncLFQueueClear); + cellSpurs->AddFunc(0x35bbdad2, _cellSyncLFQueueCompletePushPointer2); + cellSpurs->AddFunc(0x46356fe0, _cellSyncLFQueueGetPopPointer2); + cellSpurs->AddFunc(0x48154c9b, cellSyncQueuePeek); + cellSpurs->AddFunc(0x4da349b2, cellSyncQueueSize); + cellSpurs->AddFunc(0x4da6d7e0, cellSyncQueuePop); + cellSpurs->AddFunc(0x4e88c68d, _cellSyncLFQueueCompletePushPointer); + cellSpurs->AddFunc(0x54fc2032, _cellSyncLFQueueAttachLv2EventQueue); + cellSpurs->AddFunc(0x5ae841e5, cellSyncQueuePush); + cellSpurs->AddFunc(0x68af923c, cellSyncQueueTryPeek); + cellSpurs->AddFunc(0x6bb4ef9d,_cellSyncLFQueueGetPushPointer2); + cellSpurs->AddFunc(0x705985cd, cellSyncQueueTryPush); + cellSpurs->AddFunc(0x74c37666, _cellSyncLFQueueGetPopPointer); + cellSpurs->AddFunc(0x7a51deee, _cellSyncLFQueueCompletePopPointer2); + cellSpurs->AddFunc(0x811d148e, _cellSyncLFQueueDetachLv2EventQueue); + cellSpurs->AddFunc(0xa5362e73, cellSyncQueueClear); + cellSpurs->AddFunc(0xa58df87f, cellSyncQueueTryPop); + cellSpurs->AddFunc(0xaa355278, cellSyncLFQueueInitialize); + cellSpurs->AddFunc(0xaff7627a, _cellSyncLFQueueGetSignalAddress); + cellSpurs->AddFunc(0xba5961ca, _cellSyncLFQueuePushBody); + cellSpurs->AddFunc(0xd59aa307, cellSyncLFQueueGetDirection); + cellSpurs->AddFunc(0xe18c273c, cellSyncLFQueueDepth); + cellSpurs->AddFunc(0xe1bc7add, _cellSyncLFQueuePopBody); + cellSpurs->AddFunc(0xe9bf2110, _cellSyncLFQueueGetPushPointer); + cellSpurs->AddFunc(0xfe74e8e7, _cellSyncLFQueueCompletePopPointer); } + diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp index fff44dd5a4..2181a6b09e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp @@ -6,8 +6,9 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" -void cellSync_init(); -Module cellSync("cellSync", cellSync_init); +//void cellSync_init(); +//Module cellSync("cellSync", cellSync_init); +Module *cellSync = nullptr; // Return Codes enum @@ -47,7 +48,7 @@ static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong sizeof"); int cellSyncMutexInitialize(mem_ptr_t mutex) { - cellSync.Log("cellSyncMutexInitialize(mutex=0x%x)", mutex.GetAddr()); + cellSync->Log("cellSyncMutexInitialize(mutex=0x%x)", mutex.GetAddr()); if (!mutex.IsGood()) { @@ -64,7 +65,7 @@ int cellSyncMutexInitialize(mem_ptr_t mutex) int cellSyncMutexLock(mem_ptr_t mutex) { - cellSync.Log("cellSyncMutexLock(mutex=0x%x)", mutex.GetAddr()); + cellSync->Log("cellSyncMutexLock(mutex=0x%x)", mutex.GetAddr()); if (!mutex.IsGood()) { @@ -102,7 +103,7 @@ int cellSyncMutexLock(mem_ptr_t mutex) int cellSyncMutexTryLock(mem_ptr_t mutex) { - cellSync.Log("cellSyncMutexTryLock(mutex=0x%x)", mutex.GetAddr()); + cellSync->Log("cellSyncMutexTryLock(mutex=0x%x)", mutex.GetAddr()); if (!mutex.IsGood()) { @@ -138,7 +139,7 @@ int cellSyncMutexTryLock(mem_ptr_t mutex) int cellSyncMutexUnlock(mem_ptr_t mutex) { - cellSync.Log("cellSyncMutexUnlock(mutex=0x%x)", mutex.GetAddr()); + cellSync->Log("cellSyncMutexUnlock(mutex=0x%x)", mutex.GetAddr()); if (!mutex.IsGood()) { @@ -164,8 +165,8 @@ int cellSyncMutexUnlock(mem_ptr_t mutex) void cellSync_init() { - cellSync.AddFunc(0xa9072dee, cellSyncMutexInitialize); - cellSync.AddFunc(0x1bb675c2, cellSyncMutexLock); - cellSync.AddFunc(0xd06918c4, cellSyncMutexTryLock); - cellSync.AddFunc(0x91f2b7b0, cellSyncMutexUnlock); + cellSync->AddFunc(0xa9072dee, cellSyncMutexInitialize); + cellSync->AddFunc(0x1bb675c2, cellSyncMutexLock); + cellSync->AddFunc(0xd06918c4, cellSyncMutexTryLock); + cellSync->AddFunc(0x91f2b7b0, cellSyncMutexUnlock); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp index 992b9d5c73..498cd67d62 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp @@ -4,10 +4,12 @@ #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" +#include "Emu/SysCalls/ModuleManager.h" #include "Emu/SysCalls/Modules.h" -void cellSysmodule_init(); -Module cellSysmodule("cellSysmodule", cellSysmodule_init); +//void cellSysmodule_init(); +//Module cellSysmodule("cellSysmodule", cellSysmodule_init); +Module *cellSysmodule = nullptr; enum { @@ -144,19 +146,19 @@ const char *getModuleName(int id) { int cellSysmoduleInitialize() { - cellSysmodule.Log("cellSysmoduleInitialize()"); + cellSysmodule->Log("cellSysmoduleInitialize()"); return CELL_OK; } int cellSysmoduleFinalize() { - cellSysmodule.Log("cellSysmoduleFinalize()"); + cellSysmodule->Log("cellSysmoduleFinalize()"); return CELL_OK; } int cellSysmoduleSetMemcontainer(u32 ct_id) { - cellSysmodule.Warning("TODO: cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id); + cellSysmodule->Warning("TODO: cellSysmoduleSetMemcontainer(ct_id=0x%x)", ct_id); return CELL_OK; } @@ -164,10 +166,10 @@ int cellSysmoduleLoadModule(u16 id) { if (id == 0xf054) { - cellSysmodule.Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI"); + cellSysmodule->Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI"); } - cellSysmodule.Warning("cellSysmoduleLoadModule(%s)", getModuleName(id)); - Module* m = GetModuleById(id); + cellSysmodule->Warning("cellSysmoduleLoadModule(%s)", getModuleName(id)); + Module* m = Emu.GetModuleManager().GetModuleById(id); if(!m) { @@ -185,8 +187,8 @@ int cellSysmoduleLoadModule(u16 id) int cellSysmoduleUnloadModule(u16 id) { - cellSysmodule.Warning("cellSysmoduleUnloadModule(%s)", getModuleName(id)); - Module* m = GetModuleById(id); + cellSysmodule->Warning("cellSysmoduleUnloadModule(%s)", getModuleName(id)); + Module* m = Emu.GetModuleManager().GetModuleById(id); if(!m) { @@ -204,8 +206,8 @@ int cellSysmoduleUnloadModule(u16 id) int cellSysmoduleIsLoaded(u16 id) { - cellSysmodule.Warning("cellSysmoduleIsLoaded(%s)", getModuleName(id)); - Module* m = GetModuleById(id); + cellSysmodule->Warning("cellSysmoduleIsLoaded(%s)", getModuleName(id)); + Module* m = Emu.GetModuleManager().GetModuleById(id); if(!m) { @@ -217,10 +219,10 @@ int cellSysmoduleIsLoaded(u16 id) void cellSysmodule_init() { - cellSysmodule.AddFunc(0x63ff6ff9, cellSysmoduleInitialize); - cellSysmodule.AddFunc(0x96c07adf, cellSysmoduleFinalize); - cellSysmodule.AddFunc(0xa193143c, cellSysmoduleSetMemcontainer); - cellSysmodule.AddFunc(0x32267a31, cellSysmoduleLoadModule); - cellSysmodule.AddFunc(0x112a5ee9, cellSysmoduleUnloadModule); - cellSysmodule.AddFunc(0x5a59e258, cellSysmoduleIsLoaded); + cellSysmodule->AddFunc(0x63ff6ff9, cellSysmoduleInitialize); + cellSysmodule->AddFunc(0x96c07adf, cellSysmoduleFinalize); + cellSysmodule->AddFunc(0xa193143c, cellSysmoduleSetMemcontainer); + cellSysmodule->AddFunc(0x32267a31, cellSysmoduleLoadModule); + cellSysmodule->AddFunc(0x112a5ee9, cellSysmoduleUnloadModule); + cellSysmodule->AddFunc(0x5a59e258, cellSysmoduleIsLoaded); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index 369b1690d1..ca0b7f84f0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -17,12 +17,13 @@ typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t userData); typedef void (*CellHddGameStatCallback)(mem_ptr_t cbResult, mem_ptr_t get, mem_ptr_t set); -void cellSysutil_init(); -Module cellSysutil(0x0015, cellSysutil_init); +//void cellSysutil_init(); +//Module cellSysutil(0x0015, cellSysutil_init); +Module *cellSysutil; int cellSysutilGetSystemParamInt(int id, mem32_t value) { - cellSysutil.Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr()); + cellSysutil->Log("cellSysutilGetSystemParamInt(id=0x%x, value_addr=0x%x)", id, value.GetAddr()); if(!value.IsGood()) { @@ -32,77 +33,77 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value) switch(id) { case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_LANG"); value = Ini.SysLanguage.GetValue(); break; case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN"); value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT"); value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT"); value = CELL_SYSUTIL_TIME_FMT_CLOCK24; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE"); value = 3; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME"); value = 1; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL"); value = CELL_SYSUTIL_GAME_PARENTAL_OFF; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT"); value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT"); value = 0; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ"); value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE"); value = CELL_SYSUTIL_PAD_RUMBLE_OFF; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE"); value = 0; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD"); value = 0; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD"); value = 0; break; case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: - cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF"); + cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF"); value = 0; break; @@ -115,7 +116,7 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value) int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t buf, u32 bufsize) { - cellSysutil.Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.GetAddr(), bufsize); + cellSysutil->Log("cellSysutilGetSystemParamString(id=%d, buf_addr=0x%x, bufsize=%d)", id, buf.GetAddr(), bufsize); if (!buf.IsGood()) return CELL_EFAULT; @@ -125,12 +126,12 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t buf, u32 bufsize) switch(id) { case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: - cellSysutil.Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME"); + cellSysutil->Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME"); memcpy(buf, "Unknown", 8); //for example break; case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: - cellSysutil.Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME"); + cellSysutil->Warning("cellSysutilGetSystemParamString: CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME"); memcpy(buf, "Unknown", 8); break; @@ -143,7 +144,7 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t buf, u32 bufsize) int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr) { - cellSysutil.Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state_addr); + cellSysutil->Log("cellVideoOutGetState(videoOut=0x%x, deviceIndex=0x%x, state_addr=0x%x)", videoOut, deviceIndex, state_addr); if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; @@ -181,7 +182,7 @@ int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr) int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t resolution) { - cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", + cellSysutil->Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", resolutionId, resolution.GetAddr()); if (!resolution.IsGood()) @@ -199,7 +200,7 @@ int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_tWarning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)", videoOut, config_addr, option_addr, waitForEvent); if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) @@ -240,7 +241,7 @@ int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 wa int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr) { - cellSysutil.Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)", + cellSysutil->Warning("cellVideoOutGetConfiguration(videoOut=%d, config_addr=0x%x, option_addr=0x%x)", videoOut, config_addr, option_addr); if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT; @@ -271,7 +272,7 @@ int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr) int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_ptr_t info) { - cellSysutil.Warning("cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)", + cellSysutil->Warning("cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)", videoOut, deviceIndex, info.GetAddr()); if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; @@ -303,7 +304,7 @@ int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_ptr_tWarning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); switch(videoOut) { @@ -316,7 +317,7 @@ int cellVideoOutGetNumberOfDevice(u32 videoOut) int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) { - cellSysutil.Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=0x%x, option=0x%x)", + cellSysutil->Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=0x%x, option=0x%x)", videoOut, resolutionId, aspect, option); if(!ResolutionIdToNum(resolutionId)) @@ -338,7 +339,7 @@ extern std::atomic g_FsAioReadCur; int cellSysutilCheckCallback() { - cellSysutil.Log("cellSysutilCheckCallback()"); + cellSysutil->Log("cellSysutilCheckCallback()"); Emu.GetCallbackManager().m_exit_callback.Check(); @@ -359,22 +360,22 @@ int cellSysutilCheckCallback() int cellSysutilRegisterCallback(int slot, u64 func_addr, u64 userdata) { - cellSysutil.Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%llx, userdata=0x%llx)", slot, func_addr, userdata); + cellSysutil->Warning("cellSysutilRegisterCallback(slot=%d, func_addr=0x%llx, userdata=0x%llx)", slot, func_addr, userdata); Emu.GetCallbackManager().m_exit_callback.Register(slot, func_addr, userdata); - wxGetApp().SendDbgCommand(DID_REGISTRED_CALLBACK); + SendDbgCommand(DID_REGISTRED_CALLBACK); return CELL_OK; } int cellSysutilUnregisterCallback(int slot) { - cellSysutil.Warning("cellSysutilUnregisterCallback(slot=%d)", slot); + cellSysutil->Warning("cellSysutilUnregisterCallback(slot=%d)", slot); Emu.GetCallbackManager().m_exit_callback.Unregister(slot); - wxGetApp().SendDbgCommand(DID_UNREGISTRED_CALLBACK); + SendDbgCommand(DID_UNREGISTRED_CALLBACK); return CELL_OK; } @@ -385,31 +386,31 @@ int cellMsgDialogOpen2(u32 type, char* msgString, mem_func_ptr_t callback, mem_ptr_t userData, u32 extParam) { - cellSysutil.Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=%d, extParam=%d)", + cellSysutil->Warning("cellMsgDialogOpenErrorCode(errorCode=0x%x, callback_addr=0x%x, userData=%d, extParam=%d)", errorCode, callback.GetAddr(), userData, extParam); std::string errorMessage; @@ -508,10 +509,10 @@ int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_tWarning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", audioOut, type, fs, option); option = 0; @@ -573,7 +574,7 @@ int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option) int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u32 option) { - cellSysutil.Warning("cellAudioOutGetSoundAvailability2(audioOut=%d, type=%d, fs=0x%x, ch=%d, option=%d)", + cellSysutil->Warning("cellAudioOutGetSoundAvailability2(audioOut=%d, type=%d, fs=0x%x, ch=%d, option=%d)", audioOut, type, fs, ch, option); option = 0; @@ -623,7 +624,7 @@ int cellAudioOutGetSoundAvailability2(u32 audioOut, u32 type, u32 fs, u32 ch, u3 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; memset(&state, 0, sizeof(CellAudioOutState)); @@ -655,7 +656,7 @@ int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr) int cellAudioOutConfigure(u32 audioOut, mem_ptr_t config, mem_ptr_t option, u32 waitForEvent) { - cellSysutil.Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, (!)waitForEvent=%d)", + cellSysutil->Warning("cellAudioOutConfigure(audioOut=%d, config_addr=0x%x, option_addr=0x%x, (!)waitForEvent=%d)", audioOut, config.GetAddr(), option.GetAddr(), waitForEvent); if (!config.IsGood()) @@ -689,7 +690,7 @@ int cellAudioOutConfigure(u32 audioOut, mem_ptr_t con int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr) { - cellSysutil.Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)", + cellSysutil->Warning("cellAudioOutGetConfiguration(audioOut=%d, config_addr=0x%x, option_addr=0x%x)", audioOut, config_addr, option_addr); if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT; @@ -719,7 +720,7 @@ int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr) int cellAudioOutGetNumberOfDevice(u32 audioOut) { - cellSysutil.Warning("cellAudioOutGetNumberOfDevice(videoOut=%d)",audioOut); + cellSysutil->Warning("cellAudioOutGetNumberOfDevice(videoOut=%d)",audioOut); switch(audioOut) { @@ -732,7 +733,7 @@ int cellAudioOutGetNumberOfDevice(u32 audioOut) int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_t info) { - cellSysutil.Error("Unimplemented function: cellAudioOutGetDeviceInfo(audioOut=%u, deviceIndex=%u, info_addr=0x%x)", + cellSysutil->Error("Unimplemented function: cellAudioOutGetDeviceInfo(audioOut=%u, deviceIndex=%u, info_addr=0x%x)", audioOut, deviceIndex, info.GetAddr()); if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; @@ -751,7 +752,7 @@ int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_tWarning("cellAudioOutSetCopyControl(audioOut=%d,control=%d)",audioOut,control); switch(audioOut) { @@ -785,28 +786,28 @@ typedef struct{ } CellSysCacheParam; -class WxDirDeleteTraverser : public wxDirTraverser -{ -public: - virtual wxDirTraverseResult OnFile(const wxString& filename) - { - if (!wxRemoveFile(filename)){ - cellSysutil.Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); - } - return wxDIR_CONTINUE; - } - virtual wxDirTraverseResult OnDir(const wxString& dirname) - { - wxDir dir(dirname); - dir.Traverse(*this); - if (!wxRmDir(dirname)){ - //this get triggered a few times while clearing folders - //but if this gets reimplented we should probably warn - //if directories can't be removed - } - return wxDIR_CONTINUE; - } -}; +//class WxDirDeleteTraverser : public wxDirTraverser +//{ +//public: +// virtual wxDirTraverseResult OnFile(const wxString& filename) +// { +// if (!wxRemoveFile(filename)){ +// cellSysutil->Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); +// } +// return wxDIR_CONTINUE; +// } +// virtual wxDirTraverseResult OnDir(const wxString& dirname) +// { +// wxDir dir(dirname); +// dir.Traverse(*this); +// if (!wxRmDir(dirname)){ +// //this get triggered a few times while clearing folders +// //but if this gets reimplented we should probably warn +// //if directories can't be removed +// } +// return wxDIR_CONTINUE; +// } +//}; int cellSysCacheClear(void) { @@ -816,21 +817,23 @@ int cellSysCacheClear(void) std::string localPath; Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath); - //TODO: replace wxWidgetsSpecific filesystem stuff - if (wxDirExists(fmt::FromUTF8(localPath))){ - WxDirDeleteTraverser deleter; - wxString f = wxFindFirstFile(fmt::FromUTF8(localPath+"\\*"),wxDIR); - while (!f.empty()) - { - wxDir dir(f); - dir.Traverse(deleter); - f = wxFindNextFile(); - } - return CELL_SYSCACHE_RET_OK_CLEARED; - } - else{ - return CELL_SYSCACHE_ERROR_ACCESS_ERROR; - } + //TODO: implement + //if (rDirExists(localPath)){ + // WxDirDeleteTraverser deleter; + // wxString f = wxFindFirstFile(fmt::FromUTF8(localPath+"\\*"),wxDIR); + // while (!f.empty()) + // { + // wxDir dir(f); + // dir.Traverse(deleter); + // f = wxFindNextFile(); + // } + // return CELL_SYSCACHE_RET_OK_CLEARED; + //} + //else{ + // return CELL_SYSCACHE_ERROR_ACCESS_ERROR; + //} + + return CELL_SYSCACHE_RET_OK_CLEARED; } int cellSysCacheMount(mem_ptr_t param) @@ -847,7 +850,7 @@ int cellSysCacheMount(mem_ptr_t param) int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t funcStat, u32 container) { - cellSysutil.Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)", + cellSysutil->Warning("cellHddGameCheck(version=%d, dirName_addr=0x%xx, errDialog=%d, funcStat_addr=0x%x, container=%d)", version, dirName_addr, errDialog, funcStat, container); if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood()) @@ -918,7 +921,7 @@ int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_ int cellSysutilGetBgmPlaybackStatus(mem_ptr_t status) { - cellSysutil.Warning("cellSysutilGetBgmPlaybackStatus(status=0x%x)", status.GetAddr()); + cellSysutil->Warning("cellSysutilGetBgmPlaybackStatus(status=0x%x)", status.GetAddr()); // non-essential, so always assume background music is stopped/disabled status->playbackState = CELL_BGMPLAYBACK_STATUS_STOP; @@ -939,74 +942,74 @@ int cellWebBrowserEstimate2(mem8_ptr_t _config, mem32_ptr_t memSize) void cellSysutil_init() { - cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); - cellSysutil.AddFunc(0x938013a0, cellSysutilGetSystemParamString); + cellSysutil->AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); + cellSysutil->AddFunc(0x938013a0, cellSysutilGetSystemParamString); - cellSysutil.AddFunc(0x887572d5, cellVideoOutGetState); - cellSysutil.AddFunc(0xe558748d, cellVideoOutGetResolution); - cellSysutil.AddFunc(0x0bae8772, cellVideoOutConfigure); - cellSysutil.AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration); - cellSysutil.AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo); - cellSysutil.AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice); - cellSysutil.AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability); + cellSysutil->AddFunc(0x887572d5, cellVideoOutGetState); + cellSysutil->AddFunc(0xe558748d, cellVideoOutGetResolution); + cellSysutil->AddFunc(0x0bae8772, cellVideoOutConfigure); + cellSysutil->AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration); + cellSysutil->AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo); + cellSysutil->AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice); + cellSysutil->AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability); - cellSysutil.AddFunc(0x189a74da, cellSysutilCheckCallback); - cellSysutil.AddFunc(0x9d98afa0, cellSysutilRegisterCallback); - cellSysutil.AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback); + cellSysutil->AddFunc(0x189a74da, cellSysutilCheckCallback); + cellSysutil->AddFunc(0x9d98afa0, cellSysutilRegisterCallback); + cellSysutil->AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback); - cellSysutil.AddFunc(0x7603d3db, cellMsgDialogOpen2); - cellSysutil.AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode); + cellSysutil->AddFunc(0x7603d3db, cellMsgDialogOpen2); + cellSysutil->AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode); - cellSysutil.AddFunc(0xf4e3caa0, cellAudioOutGetState); - cellSysutil.AddFunc(0x4692ab35, cellAudioOutConfigure); - cellSysutil.AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability); - cellSysutil.AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2); - cellSysutil.AddFunc(0x7663e368, cellAudioOutGetDeviceInfo); - cellSysutil.AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice); - cellSysutil.AddFunc(0xed5d96af, cellAudioOutGetConfiguration); - cellSysutil.AddFunc(0xc96e89e9, cellAudioOutSetCopyControl); + cellSysutil->AddFunc(0xf4e3caa0, cellAudioOutGetState); + cellSysutil->AddFunc(0x4692ab35, cellAudioOutConfigure); + cellSysutil->AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability); + cellSysutil->AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2); + cellSysutil->AddFunc(0x7663e368, cellAudioOutGetDeviceInfo); + cellSysutil->AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice); + cellSysutil->AddFunc(0xed5d96af, cellAudioOutGetConfiguration); + cellSysutil->AddFunc(0xc96e89e9, cellAudioOutSetCopyControl); - cellSysutil.AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus); + cellSysutil->AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus); - cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount); - cellSysutil.AddFunc(0x744c1544, cellSysCacheClear); + cellSysutil->AddFunc(0x1e7bff94, cellSysCacheMount); + cellSysutil->AddFunc(0x744c1544, cellSysCacheClear); - cellSysutil.AddFunc(0x9117df20, cellHddGameCheck); - //cellSysutil.AddFunc(0x4bdec82a, cellHddGameCheck2); - //cellSysutil.AddFunc(0xf82e2ef7, cellHddGameGetSizeKB); - //cellSysutil.AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer); - //cellSysutil.AddFunc(0xafd605b3, cellHddGameExitBroken); + cellSysutil->AddFunc(0x9117df20, cellHddGameCheck); + //cellSysutil->AddFunc(0x4bdec82a, cellHddGameCheck2); + //cellSysutil->AddFunc(0xf82e2ef7, cellHddGameGetSizeKB); + //cellSysutil->AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer); + //cellSysutil->AddFunc(0xafd605b3, cellHddGameExitBroken); //cellSysutil_SaveData - //cellSysutil.AddFunc(0x04c06fc2, cellSaveDataGetListItem); - //cellSysutil.AddFunc(0x273d116a, cellSaveDataUserListExport); - //cellSysutil.AddFunc(0x27cb8bc2, cellSaveDataListDelete); - //cellSysutil.AddFunc(0x39d6ee43, cellSaveDataUserListImport); - //cellSysutil.AddFunc(0x46a2d878, cellSaveDataFixedExport); - //cellSysutil.AddFunc(0x491cc554, cellSaveDataListExport); - //cellSysutil.AddFunc(0x52541151, cellSaveDataFixedImport); - //cellSysutil.AddFunc(0x529231b0, cellSaveDataUserFixedImport); - //cellSysutil.AddFunc(0x6b4e0de6, cellSaveDataListImport); - //cellSysutil.AddFunc(0x7048a9ba, cellSaveDataUserListDelete); - //cellSysutil.AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); - //cellSysutil.AddFunc(0xf6482036, cellSaveDataUserGetListItem); - cellSysutil.AddFunc(0x2de0d663, cellSaveDataListSave2); - cellSysutil.AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); - cellSysutil.AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); - cellSysutil.AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); - cellSysutil.AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); - cellSysutil.AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); - //cellSysutil.AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); - //cellSysutil.AddFunc(0x21425307, cellSaveDataListAutoLoad); - //cellSysutil.AddFunc(0xedadd797, cellSaveDataDelete2); - //cellSysutil.AddFunc(0x0f03cfb0, cellSaveDataUserListSave); - //cellSysutil.AddFunc(0x39dd8425, cellSaveDataUserListLoad); - //cellSysutil.AddFunc(0x40b34847, cellSaveDataUserFixedSave); - //cellSysutil.AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); - //cellSysutil.AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); - //cellSysutil.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); - //cellSysutil.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); - //cellSysutil.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); + //cellSysutil->AddFunc(0x04c06fc2, cellSaveDataGetListItem); + //cellSysutil->AddFunc(0x273d116a, cellSaveDataUserListExport); + //cellSysutil->AddFunc(0x27cb8bc2, cellSaveDataListDelete); + //cellSysutil->AddFunc(0x39d6ee43, cellSaveDataUserListImport); + //cellSysutil->AddFunc(0x46a2d878, cellSaveDataFixedExport); + //cellSysutil->AddFunc(0x491cc554, cellSaveDataListExport); + //cellSysutil->AddFunc(0x52541151, cellSaveDataFixedImport); + //cellSysutil->AddFunc(0x529231b0, cellSaveDataUserFixedImport); + //cellSysutil->AddFunc(0x6b4e0de6, cellSaveDataListImport); + //cellSysutil->AddFunc(0x7048a9ba, cellSaveDataUserListDelete); + //cellSysutil->AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); + //cellSysutil->AddFunc(0xf6482036, cellSaveDataUserGetListItem); + cellSysutil->AddFunc(0x2de0d663, cellSaveDataListSave2); + cellSysutil->AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); + cellSysutil->AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); + cellSysutil->AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); + cellSysutil->AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); + cellSysutil->AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); + //cellSysutil->AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); + //cellSysutil->AddFunc(0x21425307, cellSaveDataListAutoLoad); + //cellSysutil->AddFunc(0xedadd797, cellSaveDataDelete2); + //cellSysutil->AddFunc(0x0f03cfb0, cellSaveDataUserListSave); + //cellSysutil->AddFunc(0x39dd8425, cellSaveDataUserListLoad); + //cellSysutil->AddFunc(0x40b34847, cellSaveDataUserFixedSave); + //cellSysutil->AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); + //cellSysutil->AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); + //cellSysutil->AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); + //cellSysutil->AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); + //cellSysutil->AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); - cellSysutil.AddFunc(0x6d087930, cellWebBrowserEstimate2); + cellSysutil->AddFunc(0x6d087930, cellWebBrowserEstimate2); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp index 7a45a5b5d5..79552479e6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp @@ -6,8 +6,9 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" -void cellSysutilAp_init(); -Module cellSysutilAp(0x0039, cellSysutilAp_init); +//void cellSysutilAp_init(); +//Module cellSysutilAp(0x0039, cellSysutilAp_init); +extern Module *cellSysutilAp = nullptr; // Return Codes enum @@ -24,7 +25,7 @@ enum s32 cellSysutilApGetRequiredMemSize() { - cellSysutilAp.Log("cellSysutilApGetRequiredMemSize()"); + cellSysutilAp->Log("cellSysutilApGetRequiredMemSize()"); return 1024*1024; // Return 1 MB as required size } @@ -42,7 +43,7 @@ int cellSysutilApOff() void cellSysutilAp_init() { - cellSysutilAp.AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize); - cellSysutilAp.AddFunc(0x3343824c, cellSysutilApOn); - cellSysutilAp.AddFunc(0x90c2bb19, cellSysutilApOff); + cellSysutilAp->AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize); + cellSysutilAp->AddFunc(0x3343824c, cellSysutilApOn); + cellSysutilAp->AddFunc(0x90c2bb19, cellSysutilApOff); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp index 29acae0df9..af747c1f6c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp @@ -12,7 +12,7 @@ #include "cellSysutil_SaveData.h" #include "Loader/PSF.h" -extern Module cellSysutil; +extern Module *cellSysutil; // Auxiliary Classes class sortSaveDataEntry @@ -294,7 +294,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t setList, m mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataListSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) @@ -379,7 +379,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, m mem_func_ptr_t funcList, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataListLoad2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcList_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", version, setList.GetAddr(), setBuf.GetAddr(), funcList.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) @@ -464,7 +464,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t setList, mem_func_ptr_t funcFixed, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataFixedSave2(version=%d, setList_addr=0x%x, setBuf_addr=0x%x, funcFixed_addr=0x%x, funcStat_addr=0x%x, funcFile_addr=0x%x, container=%d, userdata_addr=0x%x)", version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setList.IsGood() || !setBuf.IsGood() || !funcFixed.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) @@ -536,7 +536,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t setList, mem_func_ptr_t funcFixed, mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataFixedLoad2(version=%d, setList_addr=0x%x, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", version, setList.GetAddr(), setBuf.GetAddr(), funcFixed.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setList.IsGood() || !setBuf.IsGood() || !funcFixed.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) @@ -608,7 +608,7 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_ mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataAutoSave2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) @@ -664,7 +664,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_ mem_func_ptr_t funcStat, mem_func_ptr_t funcFile, u32 container, u32 userdata_addr) { - cellSysutil.Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", + cellSysutil->Warning("cellSaveDataAutoLoad2(version=%d, dirName_addr=0x%x, errDialog=%d, setBuf=0x%x, funcList=0x%x, funcStat=0x%x, funcFile=0x%x, container=%d, userdata_addr=0x%x)", version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr); if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) diff --git a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp index bbe3bcbc6b..5f7a08c10d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp @@ -8,12 +8,13 @@ #include "cellUserInfo.h" -void cellUserInfo_init(); -Module cellUserInfo(0x0032, cellUserInfo_init); +//void cellUserInfo_init(); +//Module cellUserInfo(0x0032, cellUserInfo_init); +extern Module *cellUserInfo = nullptr; int cellUserInfoGetStat(u32 id, mem_ptr_t stat) { - cellUserInfo.Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.GetAddr()); + cellUserInfo->Warning("cellUserInfoGetStat(id=%d, stat_addr=0x%x)", id, stat.GetAddr()); if (!stat.IsGood()) return CELL_USERINFO_ERROR_PARAM; @@ -61,7 +62,7 @@ int cellUserInfoEnableOverlay() int cellUserInfoGetList(mem32_t listNum, mem_ptr_t listBuf, mem32_t currentUserId) { - cellUserInfo.Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)", + cellUserInfo->Warning("cellUserInfoGetList(listNum_addr=0x%x, listBuf_addr=0x%x, currentUserId_addr=0x%x)", listNum.GetAddr(), listBuf.GetAddr(), currentUserId.GetAddr()); // If only listNum is NULL, an error will be returned @@ -80,9 +81,9 @@ int cellUserInfoGetList(mem32_t listNum, mem_ptr_t listBuf void cellUserInfo_init() { - cellUserInfo.AddFunc(0x2b761140, cellUserInfoGetStat); - cellUserInfo.AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType); - cellUserInfo.AddFunc(0x55123a25, cellUserInfoSelectUser_SetList); - cellUserInfo.AddFunc(0xb3516536, cellUserInfoEnableOverlay); - cellUserInfo.AddFunc(0xc55e338b, cellUserInfoGetList); + cellUserInfo->AddFunc(0x2b761140, cellUserInfoGetStat); + cellUserInfo->AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType); + cellUserInfo->AddFunc(0x55123a25, cellUserInfoSelectUser_SetList); + cellUserInfo->AddFunc(0xb3516536, cellUserInfoEnableOverlay); + cellUserInfo->AddFunc(0xc55e338b, cellUserInfoGetList); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index 6396e8a8cd..eda5a0511d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -18,8 +18,9 @@ extern "C" #include "cellVdec.h" -void cellVdec_init(); -Module cellVdec(0x0005, cellVdec_init); +//void cellVdec_init(); +//Module cellVdec(0x0005, cellVdec_init); +Module *cellVdec = nullptr; int vdecRead(void* opaque, u8* buf, int buf_size) { @@ -107,9 +108,9 @@ u32 vdecQueryAttr(CellVdecCodecType type, u32 profile, u32 spec_addr /* may be 0 { switch (type) // TODO: check profile levels { - case CELL_VDEC_CODEC_TYPE_AVC: cellVdec.Warning("cellVdecQueryAttr: AVC (profile=%d)", profile); break; - case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec.Error("TODO: MPEG2 not supported"); break; - case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec.Error("TODO: DIVX not supported"); break; + case CELL_VDEC_CODEC_TYPE_AVC: cellVdec->Warning("cellVdecQueryAttr: AVC (profile=%d)", profile); break; + case CELL_VDEC_CODEC_TYPE_MPEG2: cellVdec->Error("TODO: MPEG2 not supported"); break; + case CELL_VDEC_CODEC_TYPE_DIVX: cellVdec->Error("TODO: DIVX not supported"); break; default: return CELL_VDEC_ERROR_ARG; } @@ -127,7 +128,7 @@ u32 vdecOpen(VideoDecoder* data) vdec.vdecCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU); - u32 vdec_id = cellVdec.GetNewId(data); + u32 vdec_id = cellVdec->GetNewId(data); vdec.id = vdec_id; @@ -423,7 +424,7 @@ u32 vdecOpen(VideoDecoder* data) int cellVdecQueryAttr(const mem_ptr_t type, mem_ptr_t attr) { - cellVdec.Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); + cellVdec->Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); if (!type.IsGood() || !attr.IsGood()) { @@ -435,7 +436,7 @@ int cellVdecQueryAttr(const mem_ptr_t type, mem_ptr_t type, mem_ptr_t attr) { - cellVdec.Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); + cellVdec->Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.GetAddr(), attr.GetAddr()); if (!type.IsGood() || !attr.IsGood()) { @@ -447,7 +448,7 @@ int cellVdecQueryAttrEx(const mem_ptr_t type, mem_ptr_t type, const mem_ptr_t res, const mem_ptr_t cb, mem32_t handle) { - cellVdec.Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) @@ -467,7 +468,7 @@ int cellVdecOpen(const mem_ptr_t type, const mem_ptr_t type, const mem_ptr_t res, const mem_ptr_t cb, mem32_t handle) { - cellVdec.Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", + cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr()); if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) @@ -487,7 +488,7 @@ int cellVdecOpenEx(const mem_ptr_t type, const mem_ptr_tWarning("cellVdecClose(handle=%d)", handle); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -514,7 +515,7 @@ int cellVdecClose(u32 handle) int cellVdecStartSeq(u32 handle) { - cellVdec.Log("cellVdecStartSeq(handle=%d)", handle); + cellVdec->Log("cellVdecStartSeq(handle=%d)", handle); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -528,7 +529,7 @@ int cellVdecStartSeq(u32 handle) int cellVdecEndSeq(u32 handle) { - cellVdec.Warning("cellVdecEndSeq(handle=%d)", handle); + cellVdec->Warning("cellVdecEndSeq(handle=%d)", handle); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -564,7 +565,7 @@ int cellVdecEndSeq(u32 handle) int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const mem_ptr_t auInfo) { - cellVdec.Log("cellVdecDecodeAu(handle=%d, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.GetAddr()); + cellVdec->Log("cellVdecDecodeAu(handle=%d, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.GetAddr()); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -588,7 +589,7 @@ int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const mem_ptr_t format, u32 out_addr) { - cellVdec.Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, out_addr=0x%x)", handle, format.GetAddr(), out_addr); + cellVdec->Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, out_addr=0x%x)", handle, format.GetAddr(), out_addr); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -617,13 +618,13 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t format, u3 if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR) { - cellVdec.Error("cellVdecGetPicture: TODO: unknown formatType(%d)", (u32)format->formatType); + cellVdec->Error("cellVdecGetPicture: TODO: unknown formatType(%d)", (u32)format->formatType); return CELL_OK; } if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709) { - cellVdec.Error("cellVdecGetPicture: TODO: unknown colorMatrixType(%d)", (u32)format->colorMatrixType); + cellVdec->Error("cellVdecGetPicture: TODO: unknown colorMatrixType(%d)", (u32)format->colorMatrixType); return CELL_OK; } @@ -640,13 +641,13 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t format, u3 int err = av_image_copy_to_buffer(buf, buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1); if (err < 0) { - cellVdec.Error("cellVdecGetPicture: av_image_copy_to_buffer failed(%d)", err); + cellVdec->Error("cellVdecGetPicture: av_image_copy_to_buffer failed(%d)", err); Emu.Pause(); } if (!Memory.CopyFromReal(out_addr, buf, buf_size)) { - cellVdec.Error("cellVdecGetPicture: data copying failed"); + cellVdec->Error("cellVdecGetPicture: data copying failed"); Emu.Pause(); } @@ -660,7 +661,7 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t format, u3 int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr) { - cellVdec.Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.GetAddr()); + cellVdec->Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.GetAddr()); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -775,7 +776,7 @@ int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr) int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) { - cellVdec.Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc); + cellVdec->Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc); VideoDecoder* vdec; if (!Emu.GetIdManager().GetIDData(handle, vdec)) @@ -793,17 +794,17 @@ int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) void cellVdec_init() { - cellVdec.AddFunc(0xff6f6ebe, cellVdecQueryAttr); - cellVdec.AddFunc(0xc982a84a, cellVdecQueryAttrEx); - cellVdec.AddFunc(0xb6bbcd5d, cellVdecOpen); - cellVdec.AddFunc(0x0053e2d8, cellVdecOpenEx); - cellVdec.AddFunc(0x16698e83, cellVdecClose); - cellVdec.AddFunc(0xc757c2aa, cellVdecStartSeq); - cellVdec.AddFunc(0x824433f0, cellVdecEndSeq); - cellVdec.AddFunc(0x2bf4ddd2, cellVdecDecodeAu); - cellVdec.AddFunc(0x807c861a, cellVdecGetPicture); - cellVdec.AddFunc(0x17c702b9, cellVdecGetPicItem); - cellVdec.AddFunc(0xe13ef6fc, cellVdecSetFrameRate); + cellVdec->AddFunc(0xff6f6ebe, cellVdecQueryAttr); + cellVdec->AddFunc(0xc982a84a, cellVdecQueryAttrEx); + cellVdec->AddFunc(0xb6bbcd5d, cellVdecOpen); + cellVdec->AddFunc(0x0053e2d8, cellVdecOpenEx); + cellVdec->AddFunc(0x16698e83, cellVdecClose); + cellVdec->AddFunc(0xc757c2aa, cellVdecStartSeq); + cellVdec->AddFunc(0x824433f0, cellVdecEndSeq); + cellVdec->AddFunc(0x2bf4ddd2, cellVdecDecodeAu); + cellVdec->AddFunc(0x807c861a, cellVdecGetPicture); + cellVdec->AddFunc(0x17c702b9, cellVdecGetPicItem); + cellVdec->AddFunc(0xe13ef6fc, cellVdecSetFrameRate); av_register_all(); avcodec_register_all(); diff --git a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp index a8139c8856..ce91fbf3e4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp @@ -13,12 +13,13 @@ extern "C" #include "cellVpost.h" -void cellVpost_init(); -Module cellVpost(0x0008, cellVpost_init); +//void cellVpost_init(); +//Module cellVpost(0x0008, cellVpost_init); +Module *cellVpost = nullptr; int cellVpostQueryAttr(const mem_ptr_t cfgParam, mem_ptr_t attr) { - cellVpost.Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.GetAddr(), attr.GetAddr()); + cellVpost->Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.GetAddr(), attr.GetAddr()); if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_Q_ARG_CFG_NULL; if (!attr.IsGood()) return CELL_VPOST_ERROR_Q_ARG_ATTR_NULL; @@ -35,7 +36,7 @@ int cellVpostQueryAttr(const mem_ptr_t cfgParam, mem_ptr_tGetNewId(data); ConLog.Write("*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id); @@ -44,7 +45,7 @@ u32 vpostOpen(VpostInstance* data) int cellVpostOpen(const mem_ptr_t cfgParam, const mem_ptr_t resource, mem32_t handle) { - cellVpost.Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", + cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr()); if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL; @@ -58,7 +59,7 @@ int cellVpostOpen(const mem_ptr_t cfgParam, const mem_ptr_t cfgParam, const mem_ptr_t resource, mem32_t handle) { - cellVpost.Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", + cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr()); if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL; @@ -72,7 +73,7 @@ int cellVpostOpenEx(const mem_ptr_t cfgParam, const mem_ptr_t int cellVpostClose(u32 handle) { - cellVpost.Warning("cellVpostClose(handle=0x%x)", handle); + cellVpost->Warning("cellVpostClose(handle=0x%x)", handle); VpostInstance* vpost; if (!Emu.GetIdManager().GetIDData(handle, vpost)) @@ -87,7 +88,7 @@ int cellVpostClose(u32 handle) int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t ctrlParam, u32 outPicBuff_addr, mem_ptr_t picInfo) { - cellVpost.Log("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)", + cellVpost->Log("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)", handle, inPicBuff_addr, ctrlParam.GetAddr(), outPicBuff_addr, picInfo.GetAddr()); VpostInstance* vpost; @@ -170,19 +171,19 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_tError("cellVpostExec: data copying failed(pY)"); Emu.Pause(); } if (!Memory.CopyToReal(pU, inPicBuff_addr + w*h, w*h/4)) { - cellVpost.Error("cellVpostExec: data copying failed(pU)"); + cellVpost->Error("cellVpostExec: data copying failed(pU)"); Emu.Pause(); } if (!Memory.CopyToReal(pV, inPicBuff_addr + w*h + w*h/4, w*h/4)) { - cellVpost.Error("cellVpostExec: data copying failed(pV)"); + cellVpost->Error("cellVpostExec: data copying failed(pV)"); Emu.Pause(); } @@ -207,7 +208,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_tError("cellVpostExec: data copying failed(result)"); Emu.Pause(); } @@ -224,9 +225,9 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_tAddFunc(0x95e788c3, cellVpostQueryAttr); + cellVpost->AddFunc(0xcd33f3e2, cellVpostOpen); + cellVpost->AddFunc(0x40524325, cellVpostOpenEx); + cellVpost->AddFunc(0x10ef39f6, cellVpostClose); + cellVpost->AddFunc(0xabb8cc3d, cellVpostExec); } diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index 211211cf05..fbff7eb9ee 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -8,8 +8,9 @@ #include "Emu/Audio/cellAudio.h" #include "libmixer.h" -void libmixer_init(); -Module libmixer("libmixer", libmixer_init); +//void libmixer_init(); +//Module libmixer("libmixer", libmixer_init); +Module *libmixer = nullptr; CellSurMixerConfig surMixer; @@ -41,12 +42,12 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl if (aan_handle == 0x11111111 && samples == 256 && type && offset == 0) { - libmixer.Log("cellAANAddData(handle=0x%x, port=0x%x, offset=0x%x, addr=0x%x, samples=0x%x)", + libmixer->Log("cellAANAddData(handle=0x%x, port=0x%x, offset=0x%x, addr=0x%x, samples=0x%x)", aan_handle, aan_port, offset, addr, samples); } else { - libmixer.Error("cellAANAddData(handle=0x%x, port=0x%x, offset=0x%x, addr=0x%x, samples=0x%x)", + libmixer->Error("cellAANAddData(handle=0x%x, port=0x%x, offset=0x%x, addr=0x%x, samples=0x%x)", aan_handle, aan_port, offset, addr, samples); Emu.Pause(); return CELL_OK; @@ -108,88 +109,88 @@ int cellAANAddData(u32 aan_handle, u32 aan_port, u32 offset, u32 addr, u32 sampl int cellAANConnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) { - libmixer.Error("cellAANConnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", + libmixer->Error("cellAANConnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); return CELL_OK; } int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) { - libmixer.Error("cellAANDisconnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", + libmixer->Error("cellAANDisconnect(receive=0x%x, receivePortNo=0x%x, source=0x%x, sourcePortNo=0x%x)", receive, receivePortNo, source, sourcePortNo); return CELL_OK; } int cellSSPlayerCreate(mem32_t handle, mem_ptr_t config) { - libmixer.Error("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)", + libmixer->Error("cellSSPlayerCreate(handle_addr=0x%x, config_addr=0x%x)", handle.GetAddr(), config.GetAddr()); return CELL_OK; } int cellSSPlayerRemove(u32 handle) { - libmixer.Error("cellSSPlayerRemove(handle=%d)", handle); + libmixer->Error("cellSSPlayerRemove(handle=%d)", handle); return CELL_OK; } int cellSSPlayerSetWave(u32 handle, mem_ptr_t waveInfo, mem_ptr_t commonInfo) { - libmixer.Error("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)", + libmixer->Error("cellSSPlayerSetWave(handle=%d, waveInfo_addr=0x%x, commonInfo_addr=0x%x)", handle, waveInfo.GetAddr(), commonInfo.GetAddr()); return CELL_OK; } int cellSSPlayerPlay(u32 handle, mem_ptr_t info) { - libmixer.Error("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); + libmixer->Error("cellSSPlayerPlay(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); return CELL_OK; } int cellSSPlayerStop(u32 handle, u32 mode) { - libmixer.Error("cellSSPlayerStop(handle=%d, mode=0x%x)", handle, mode); + libmixer->Error("cellSSPlayerStop(handle=%d, mode=0x%x)", handle, mode); return CELL_OK; } int cellSSPlayerSetParam(u32 handle, mem_ptr_t info) { - libmixer.Error("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); + libmixer->Error("cellSSPlayerSetParam(handle=%d, info_addr=0x%x)", handle, info.GetAddr()); return CELL_OK; } s32 cellSSPlayerGetState(u32 handle) { - libmixer.Error("cellSSPlayerGetState(handle=%d) -> OFF", handle); + libmixer->Error("cellSSPlayerGetState(handle=%d) -> OFF", handle); return CELL_SSPLAYER_STATE_OFF; } int cellSurMixerCreate(const mem_ptr_t config) { - libmixer.Warning("cellSurMixerCreate(config_addr=0x%x)", config.GetAddr()); + libmixer->Warning("cellSurMixerCreate(config_addr=0x%x)", config.GetAddr()); surMixer = *config; - libmixer.Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", + libmixer->Warning("*** surMixer created (ch1=%d, ch2=%d, ch6=%d, ch8=%d)", (u32)surMixer.chStrips1, (u32)surMixer.chStrips2, (u32)surMixer.chStrips6, (u32)surMixer.chStrips8); return CELL_OK; } int cellSurMixerGetAANHandle(mem32_t handle) { - libmixer.Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> 0x11111111", handle.GetAddr()); + libmixer->Warning("cellSurMixerGetAANHandle(handle_addr=0x%x) -> 0x11111111", handle.GetAddr()); handle = 0x11111111; return CELL_OK; } int cellSurMixerChStripGetAANPortNo(mem32_t port, u32 type, u32 index) { - libmixer.Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.GetAddr(), type, index, (type << 16) | index); + libmixer->Warning("cellSurMixerChStripGetAANPortNo(port_addr=0x%x, type=0x%x, index=0x%x) -> 0x%x", port.GetAddr(), type, index, (type << 16) | index); port = (type << 16) | index; return CELL_OK; } int cellSurMixerSetNotifyCallback(u32 func, u32 arg) { - libmixer.Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x, arg=0x%x) (surMixerCb=0x%x)", func, arg, surMixerCb); + libmixer->Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x, arg=0x%x) (surMixerCb=0x%x)", func, arg, surMixerCb); surMixerCb = func; surMixerCbArg = arg; return CELL_OK; @@ -197,7 +198,7 @@ int cellSurMixerSetNotifyCallback(u32 func, u32 arg) int cellSurMixerRemoveNotifyCallback(u32 func) { - libmixer.Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x) (surMixerCb=0x%x)", func, surMixerCb); + libmixer->Warning("cellSurMixerSetNotifyCallback(func_addr=0x%x) (surMixerCb=0x%x)", func, surMixerCb); surMixerCb = 0; surMixerCbArg = 0; return CELL_OK; @@ -205,7 +206,7 @@ int cellSurMixerRemoveNotifyCallback(u32 func) int cellSurMixerStart() { - libmixer.Warning("cellSurMixerStart()"); + libmixer->Warning("cellSurMixerStart()"); AudioPortConfig& port = m_config.m_ports[SUR_PORT]; @@ -219,7 +220,7 @@ int cellSurMixerStart() port.attr = 0; port.level = 1.0f; - libmixer.Warning("*** audio port opened(default)"); + libmixer->Warning("*** audio port opened(default)"); port.m_is_audio_port_opened = true; port.tag = 0; @@ -282,13 +283,13 @@ int cellSurMixerStart() int cellSurMixerSetParameter(u32 param, float value) { - libmixer.Error("cellSurMixerSetParameter(param=0x%x, value=%f)", param, value); + libmixer->Error("cellSurMixerSetParameter(param=0x%x, value=%f)", param, value); return CELL_OK; } int cellSurMixerFinalize() { - libmixer.Warning("cellSurMixerFinalize()"); + libmixer->Warning("cellSurMixerFinalize()"); AudioPortConfig& port = m_config.m_ports[SUR_PORT]; @@ -306,11 +307,11 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, u32 addr, u32 samples) { if (busNo < 8 && samples == 256 && offset == 0) { - libmixer.Log("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); + libmixer->Log("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); } else { - libmixer.Error("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); + libmixer->Error("cellSurMixerSurBusAddData(busNo=%d, offset=0x%x, addr=0x%x, samples=%d)", busNo, offset, addr, samples); Emu.Pause(); return CELL_OK; } @@ -329,38 +330,38 @@ int cellSurMixerSurBusAddData(u32 busNo, u32 offset, u32 addr, u32 samples) int cellSurMixerChStripSetParameter(u32 type, u32 index, mem_ptr_t param) { - libmixer.Error("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.GetAddr()); + libmixer->Error("cellSurMixerChStripSetParameter(type=%d, index=%d, param_addr=0x%x)", type, index, param.GetAddr()); return CELL_OK; } int cellSurMixerPause(u32 type) { - libmixer.Error("cellSurMixerPause(type=%d)", type); + libmixer->Error("cellSurMixerPause(type=%d)", type); return CELL_OK; } int cellSurMixerGetCurrentBlockTag(mem64_t tag) { - libmixer.Error("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.GetAddr()); + libmixer->Error("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.GetAddr()); return CELL_OK; } int cellSurMixerGetTimestamp(u64 tag, mem64_t stamp) { - libmixer.Error("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.GetAddr()); + libmixer->Error("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.GetAddr()); return CELL_OK; } void cellSurMixerBeep(u32 arg) { - libmixer.Error("cellSurMixerBeep(arg=%d)", arg); + libmixer->Error("cellSurMixerBeep(arg=%d)", arg); return; } void cellSurMixerUtilGetLevelFromDB(float dB) { // not hooked, probably unnecessary - libmixer.Error("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); + libmixer->Error("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); declCPU(); (float&)CPU.FPR[0] = 0.0f; } @@ -368,7 +369,7 @@ void cellSurMixerUtilGetLevelFromDB(float dB) void cellSurMixerUtilGetLevelFromDBIndex(int index) { // not hooked, probably unnecessary - libmixer.Error("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); + libmixer->Error("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); declCPU(); (float&)CPU.FPR[0] = 0.0f; } @@ -376,7 +377,7 @@ void cellSurMixerUtilGetLevelFromDBIndex(int index) void cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) { // not hooked, probably unnecessary - libmixer.Error("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); + libmixer->Error("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); declCPU(); (float&)CPU.FPR[0] = 0.0f; } diff --git a/rpcs3/Emu/SysCalls/Modules/libsnd3.h b/rpcs3/Emu/SysCalls/Modules/libsnd3.h index ade551315b..7e97a34839 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsnd3.h +++ b/rpcs3/Emu/SysCalls/Modules/libsnd3.h @@ -1,4 +1,3 @@ -#if 0 #pragma once //libsnd3 Error Codes @@ -53,4 +52,3 @@ struct CellSnd3RequestQueueCtx void *rearQueue; be_t rearQueueSize; }; -#endif diff --git a/rpcs3/Emu/SysCalls/Modules/libsynth2.h b/rpcs3/Emu/SysCalls/Modules/libsynth2.h index d7985c0742..8b1c428855 100644 --- a/rpcs3/Emu/SysCalls/Modules/libsynth2.h +++ b/rpcs3/Emu/SysCalls/Modules/libsynth2.h @@ -1,4 +1,3 @@ -#if 0 #pragma once enum @@ -17,5 +16,4 @@ struct CellSoundSynth2EffectAttr be_t depth_R; be_t delay; be_t feedback; -}; -#endif +}; \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index a144896681..eef93a06e0 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -9,71 +9,74 @@ #include "Crypto/unedat.h" #include "sceNp.h" -void sceNp_init(); -Module sceNp(0x0016, sceNp_init); +//void sceNp_init(); +//Module sceNp(0x0016, sceNp_init); +Module *sceNp = nullptr; int sceNpInit(u32 mem_size, u32 mem_addr) { - sceNp.Log("sceNpInit(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr); + sceNp->Log("sceNpInit(mem_size=0x%x, mem_addr=0x%x)", mem_size, mem_addr); return CELL_OK; } int sceNpTerm() { - sceNp.Log("sceNpTerm"); + sceNp->Log("sceNpTerm"); return CELL_OK; } int sceNpDrmIsAvailable(u32 k_licensee_addr, u32 drm_path_addr) { - sceNp.Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x)", k_licensee_addr, drm_path_addr); + sceNp->Warning("sceNpDrmIsAvailable(k_licensee_addr=0x%x, drm_path_addr=0x%x)", k_licensee_addr, drm_path_addr); - wxString drm_path = fmt::FromUTF8(Memory.ReadString(drm_path_addr)); - wxString k_licensee_str; + std::string drm_path = Memory.ReadString(drm_path_addr); + std::string k_licensee_str; u8 k_licensee[0x10]; for(int i = 0; i < 0x10; i++) { k_licensee[i] = Memory.Read8(k_licensee_addr + i); - k_licensee_str += wxString::Format("%02x", k_licensee[i]); + k_licensee_str += fmt::Format("%02x", k_licensee[i]); } - sceNp.Warning("sceNpDrmIsAvailable: Found DRM license file at %s", fmt::ToUTF8(drm_path).c_str()); - sceNp.Warning("sceNpDrmIsAvailable: Using k_licensee 0x%s", fmt::ToUTF8(k_licensee_str).c_str()); + sceNp->Warning("sceNpDrmIsAvailable: Found DRM license file at %s", drm_path.c_str()); + sceNp->Warning("sceNpDrmIsAvailable: Using k_licensee 0x%s", k_licensee_str.c_str()); // Set the necessary file paths. - wxString drm_file_name = drm_path.AfterLast('/'); - wxString titleID = drm_path.AfterFirst('/').AfterFirst('/').AfterFirst('/').BeforeFirst('/'); + std::string drm_file_name = fmt::AfterLast(drm_path,'/'); - wxString enc_drm_path = wxGetCwd() + drm_path; - wxString dec_drm_path = wxGetCwd() + "/dev_hdd1/" + titleID + "/" + drm_file_name; + //make more explicit what this actually does (currently everything after the third slash and before the fourth slash) + std::string titleID = fmt::BeforeFirst(fmt::AfterFirst(fmt::AfterFirst(fmt::AfterFirst(drm_path,'/'),'/'),'/'),'/'); - wxString rap_dir_path = wxGetCwd() + "/dev_usb000/"; - wxString rap_file_path = rap_dir_path; + std::string enc_drm_path = rGetCwd() + drm_path; + std::string dec_drm_path = rGetCwd() + "/dev_hdd1/" + titleID + "/" + drm_file_name; + + std::string rap_dir_path = rGetCwd() + "/dev_usb000/"; + std::string rap_file_path = rap_dir_path; // Search dev_usb000 for a compatible RAP file. - vfsDir *raps_dir = new vfsDir(fmt::ToUTF8(rap_dir_path)); + vfsDir *raps_dir = new vfsDir(rap_dir_path); if (!raps_dir->IsOpened()) - sceNp.Warning("sceNpDrmIsAvailable: Can't find RAP file for DRM!"); + sceNp->Warning("sceNpDrmIsAvailable: Can't find RAP file for DRM!"); else { const std::vector &entries = raps_dir->GetEntries(); for (auto &entry: entries) { - if (entry.name.find(fmt::ToUTF8(titleID)) != std::string::npos ) + if (entry.name.find(titleID) != std::string::npos ) { - rap_file_path += fmt::FromUTF8(entry.name); + rap_file_path += entry.name; break; } } } // Create a new directory under dev_hdd1/titleID to hold the decrypted data. - wxString tmp_dir = wxGetCwd() + "/dev_hdd1/" + titleID; - if (!wxDir::Exists(tmp_dir)) - wxMkdir(wxGetCwd() + "/dev_hdd1/" + titleID); + std::string tmp_dir = rGetCwd() + "/dev_hdd1/" + titleID; + if (!rDir::Exists(tmp_dir)) + rMkdir(rGetCwd() + "/dev_hdd1/" + titleID); // Decrypt this EDAT using the supplied k_licensee and matching RAP file. - DecryptEDAT(fmt::ToUTF8(enc_drm_path), fmt::ToUTF8(dec_drm_path), 8, fmt::ToUTF8(rap_file_path), k_licensee, false); + DecryptEDAT(enc_drm_path, dec_drm_path, 8, rap_file_path, k_licensee, false); return CELL_OK; } @@ -110,7 +113,7 @@ int sceNpDrmGetTimelimit(u32 drm_path_addr, mem64_t time_remain_usec) int sceNpManagerGetStatus(mem32_t status) { - sceNp.Log("sceNpManagerGetStatus(status_addr=0x%x)", status.GetAddr()); + sceNp->Log("sceNpManagerGetStatus(status_addr=0x%x)", status.GetAddr()); // TODO: Check if sceNpInit() was called, if not return SCE_NP_ERROR_NOT_INITIALIZED if (!status.IsGood()) @@ -123,13 +126,13 @@ int sceNpManagerGetStatus(mem32_t status) void sceNp_init() { - sceNp.AddFunc(0xbd28fdbf, sceNpInit); - sceNp.AddFunc(0x4885aa18, sceNpTerm); - sceNp.AddFunc(0xad218faf, sceNpDrmIsAvailable); - sceNp.AddFunc(0xf042b14f, sceNpDrmIsAvailable2); - sceNp.AddFunc(0x2ecd48ed, sceNpDrmVerifyUpgradeLicense); - sceNp.AddFunc(0xbe0e3ee2, sceNpDrmVerifyUpgradeLicense2); - sceNp.AddFunc(0xf283c143, sceNpDrmExecuteGamePurchase); - sceNp.AddFunc(0xcf51864b, sceNpDrmGetTimelimit); - sceNp.AddFunc(0xa7bff757, sceNpManagerGetStatus); + sceNp->AddFunc(0xbd28fdbf, sceNpInit); + sceNp->AddFunc(0x4885aa18, sceNpTerm); + sceNp->AddFunc(0xad218faf, sceNpDrmIsAvailable); + sceNp->AddFunc(0xf042b14f, sceNpDrmIsAvailable2); + sceNp->AddFunc(0x2ecd48ed, sceNpDrmVerifyUpgradeLicense); + sceNp->AddFunc(0xbe0e3ee2, sceNpDrmVerifyUpgradeLicense2); + sceNp->AddFunc(0xf283c143, sceNpDrmExecuteGamePurchase); + sceNp->AddFunc(0xcf51864b, sceNpDrmGetTimelimit); + sceNp->AddFunc(0xa7bff757, sceNpManagerGetStatus); } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index ab31e1097b..0897f5ab61 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -16,10 +16,12 @@ #include "Emu/SysCalls/lv2/SC_Time.h" #include +#include -void sceNpTrophy_unload(); -void sceNpTrophy_init(); -Module sceNpTrophy(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload); +//void sceNpTrophy_unload(); +//void sceNpTrophy_init(); +//Module sceNpTrophy(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload); +Module *sceNpTrophy = nullptr; // Internal Structs struct sceNpTrophyInternalContext @@ -76,7 +78,7 @@ sceNpTrophyInternal s_npTrophyInstance; // Functions int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options) { - sceNpTrophy.Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=%d, options=0x%llx)", pool_addr, poolSize, containerId, options); + sceNpTrophy->Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=%d, options=0x%llx)", pool_addr, poolSize, containerId, options); if (s_npTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED; @@ -89,7 +91,7 @@ int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options) int sceNpTrophyCreateContext(mem32_t context, mem_ptr_t commID, mem_ptr_t commSign, u64 options) { - sceNpTrophy.Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", + sceNpTrophy->Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)", context.GetAddr(), commID.GetAddr(), commSign.GetAddr(), options); if (!s_npTrophyInstance.m_bInitialized) @@ -129,7 +131,7 @@ int sceNpTrophyCreateContext(mem32_t context, mem_ptr_t co int sceNpTrophyCreateHandle(mem32_t handle) { - sceNpTrophy.Warning("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.GetAddr()); + sceNpTrophy->Warning("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; @@ -144,7 +146,7 @@ int sceNpTrophyCreateHandle(mem32_t handle) int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 arg_addr, u64 options) { - sceNpTrophy.Warning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)", + sceNpTrophy->Warning("sceNpTrophyRegisterContext(context=%d, handle=%d, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)", context, handle, statusCb_addr, arg_addr, options); if (!(s_npTrophyInstance.m_bInitialized)) @@ -221,7 +223,7 @@ int sceNpTrophySetSoundLevel() int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u64 options) { - sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", + sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)", context, handle, reqspace.GetAddr(), options); if (!s_npTrophyInstance.m_bInitialized) @@ -254,7 +256,7 @@ int sceNpTrophyAbortHandle() int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_t details, mem_ptr_t data) { - sceNpTrophy.Warning("sceNpTrophyGetGameInfo(context=%d, handle=%d, details_addr=0x%x, data_addr=0x%x)", + sceNpTrophy->Warning("sceNpTrophyGetGameInfo(context=%d, handle=%d, details_addr=0x%x, data_addr=0x%x)", context, handle, details.GetAddr(), data.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) @@ -264,24 +266,24 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_tGetChildren(); n; n = n->GetNext()) { + for (std::shared_ptr n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) { if (n->GetName() == "title-name") - titleName = fmt::ToUTF8(n->GetNodeContent()); + titleName = n->GetNodeContent(); if (n->GetName() == "title-detail") - titleDetail = fmt::ToUTF8(n->GetNodeContent()); + titleDetail = n->GetNodeContent(); if (n->GetName() == "trophy") { - u32 trophy_id = atoi(fmt::ToUTF8(n->GetAttribute("id")).c_str()); + u32 trophy_id = atoi(n->GetAttribute("id").c_str()); details->numTrophies++; - switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) { + switch (n->GetAttribute("ttype")[0]) { case 'B': details->numBronze++; break; case 'S': details->numSilver++; break; case 'G': details->numGold++; break; @@ -291,7 +293,7 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, mem_ptr_tGetTrophyUnlockState(trophy_id)) { data->unlockedTrophies++; - switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) { + switch (n->GetAttribute("ttype")[0]) { case 'B': data->unlockedBronze++; break; case 'S': data->unlockedSilver++; break; case 'G': data->unlockedGold++; break; @@ -314,7 +316,7 @@ int sceNpTrophyDestroyHandle() int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t platinumId) { - sceNpTrophy.Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)", + sceNpTrophy->Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)", context, handle, trophyId, platinumId.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) @@ -347,7 +349,7 @@ int sceNpTrophyTerm() int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, mem_ptr_t flags, mem32_t count) { - sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)", + sceNpTrophy->Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)", context, handle, flags.GetAddr(), count.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) @@ -381,7 +383,7 @@ int sceNpTrophyGetTrophyIcon() int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t details, mem_ptr_t data) { - sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", + sceNpTrophy->Warning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", context, handle, trophyId, details.GetAddr(), data.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) @@ -391,32 +393,32 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_tGetChildren(); n; n = n->GetNext()) { - if (n->GetName() == "trophy" && (trophyId == atoi(fmt::ToUTF8(n->GetAttribute("id")).c_str()))) + for (std::shared_ptr n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) { + if (n->GetName() == "trophy" && (trophyId == atoi(n->GetAttribute("id").c_str()))) { details->trophyId = trophyId; - switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) { + switch (n->GetAttribute("ttype")[0]) { case 'B': details->trophyGrade = SCE_NP_TROPHY_GRADE_BRONZE; break; case 'S': details->trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; break; case 'G': details->trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; break; case 'P': details->trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; break; } - switch (fmt::ToUTF8(n->GetAttribute("ttype"))[0]) { + switch (n->GetAttribute("ttype")[0]) { case 'y': details->hidden = true; break; case 'n': details->hidden = false; break; } - for (wxXmlNode *n2 = n->GetChildren(); n2; n2 = n2->GetNext()) { - if (n2->GetName() == "name") name = fmt::ToUTF8(n2->GetNodeContent()); - if (n2->GetName() == "detail") detail = fmt::ToUTF8(n2->GetNodeContent()); + for (std::shared_ptr n2 = n->GetChildren(); n2; n2 = n2->GetNext()) { + if (n2->GetName() == "name") name = n2->GetNodeContent(); + if (n2->GetName() == "detail") detail = n2->GetNodeContent(); } data->trophyId = trophyId; @@ -443,21 +445,21 @@ void sceNpTrophy_unload() void sceNpTrophy_init() { - sceNpTrophy.AddFunc(0x079f0e87, sceNpTrophyGetGameProgress); - sceNpTrophy.AddFunc(0x1197b52c, sceNpTrophyRegisterContext); - sceNpTrophy.AddFunc(0x1c25470d, sceNpTrophyCreateHandle); - sceNpTrophy.AddFunc(0x27deda93, sceNpTrophySetSoundLevel); - sceNpTrophy.AddFunc(0x370136fe, sceNpTrophyGetRequiredDiskSpace); - sceNpTrophy.AddFunc(0x3741ecc7, sceNpTrophyDestroyContext); - sceNpTrophy.AddFunc(0x39567781, sceNpTrophyInit); - sceNpTrophy.AddFunc(0x48bd97c7, sceNpTrophyAbortHandle); - sceNpTrophy.AddFunc(0x49d18217, sceNpTrophyGetGameInfo); - sceNpTrophy.AddFunc(0x623cd2dc, sceNpTrophyDestroyHandle); - sceNpTrophy.AddFunc(0x8ceedd21, sceNpTrophyUnlockTrophy); - sceNpTrophy.AddFunc(0xa7fabf4d, sceNpTrophyTerm); - sceNpTrophy.AddFunc(0xb3ac3478, sceNpTrophyGetTrophyUnlockState); - sceNpTrophy.AddFunc(0xbaedf689, sceNpTrophyGetTrophyIcon); - sceNpTrophy.AddFunc(0xe3bf9a28, sceNpTrophyCreateContext); - sceNpTrophy.AddFunc(0xfce6d30a, sceNpTrophyGetTrophyInfo); - sceNpTrophy.AddFunc(0xff299e03, sceNpTrophyGetGameIcon); + sceNpTrophy->AddFunc(0x079f0e87, sceNpTrophyGetGameProgress); + sceNpTrophy->AddFunc(0x1197b52c, sceNpTrophyRegisterContext); + sceNpTrophy->AddFunc(0x1c25470d, sceNpTrophyCreateHandle); + sceNpTrophy->AddFunc(0x27deda93, sceNpTrophySetSoundLevel); + sceNpTrophy->AddFunc(0x370136fe, sceNpTrophyGetRequiredDiskSpace); + sceNpTrophy->AddFunc(0x3741ecc7, sceNpTrophyDestroyContext); + sceNpTrophy->AddFunc(0x39567781, sceNpTrophyInit); + sceNpTrophy->AddFunc(0x48bd97c7, sceNpTrophyAbortHandle); + sceNpTrophy->AddFunc(0x49d18217, sceNpTrophyGetGameInfo); + sceNpTrophy->AddFunc(0x623cd2dc, sceNpTrophyDestroyHandle); + sceNpTrophy->AddFunc(0x8ceedd21, sceNpTrophyUnlockTrophy); + sceNpTrophy->AddFunc(0xa7fabf4d, sceNpTrophyTerm); + sceNpTrophy->AddFunc(0xb3ac3478, sceNpTrophyGetTrophyUnlockState); + sceNpTrophy->AddFunc(0xbaedf689, sceNpTrophyGetTrophyIcon); + sceNpTrophy->AddFunc(0xe3bf9a28, sceNpTrophyCreateContext); + sceNpTrophy->AddFunc(0xfce6d30a, sceNpTrophyGetTrophyInfo); + sceNpTrophy->AddFunc(0xff299e03, sceNpTrophyGetGameIcon); } diff --git a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp index 9bd4d52244..7012678dcc 100644 --- a/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sysPrxForUser.cpp @@ -11,23 +11,24 @@ #include "Loader/ELF.h" #include "Emu/Cell/RawSPUThread.h" -void sysPrxForUser_init(); -Module sysPrxForUser("sysPrxForUser", sysPrxForUser_init); +//void sysPrxForUser_init(); +//Module sysPrxForUser("sysPrxForUser", sysPrxForUser_init); +Module *sysPrxForUser = nullptr; void sys_initialize_tls() { - sysPrxForUser.Log("sys_initialize_tls()"); + sysPrxForUser->Log("sys_initialize_tls()"); } s64 sys_process_atexitspawn() { - sysPrxForUser.Log("sys_process_atexitspawn()"); + sysPrxForUser->Log("sys_process_atexitspawn()"); return CELL_OK; } s64 sys_process_at_Exitspawn() { - sysPrxForUser.Log("sys_process_at_Exitspawn"); + sysPrxForUser->Log("sys_process_at_Exitspawn"); return CELL_OK; } @@ -42,44 +43,44 @@ int sys_process_is_stack(u32 p) int sys_spu_printf_initialize(int a1, int a2, int a3, int a4, int a5) { - sysPrxForUser.Warning("sys_spu_printf_initialize(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)", a1, a2, a3, a4, a5); + sysPrxForUser->Warning("sys_spu_printf_initialize(0x%x, 0x%x, 0x%x, 0x%x, 0x%x)", a1, a2, a3, a4, a5); return CELL_OK; } s64 sys_prx_register_library(u32 lib_addr) { - sysPrxForUser.Error("sys_prx_register_library(lib_addr=0x%x)", lib_addr); + sysPrxForUser->Error("sys_prx_register_library(lib_addr=0x%x)", lib_addr); return CELL_OK; } s64 sys_prx_exitspawn_with_level() { - sysPrxForUser.Log("sys_prx_exitspawn_with_level()"); + sysPrxForUser->Log("sys_prx_exitspawn_with_level()"); return CELL_OK; } s64 sys_strlen(u32 addr) { const std::string& str = Memory.ReadString(addr); - sysPrxForUser.Log("sys_strlen(0x%x - \"%s\")", addr, str.c_str()); + sysPrxForUser->Log("sys_strlen(0x%x - \"%s\")", addr, str.c_str()); return str.length(); } int sys_spu_elf_get_information(u32 elf_img, mem32_t entry, mem32_t nseg) { - sysPrxForUser.Warning("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x", elf_img, entry.GetAddr(), nseg.GetAddr()); + sysPrxForUser->Warning("sys_spu_elf_get_information(elf_img=0x%x, entry_addr=0x%x, nseg_addr=0x%x", elf_img, entry.GetAddr(), nseg.GetAddr()); return CELL_OK; } int sys_spu_elf_get_segments(u32 elf_img, mem_ptr_t segments, int nseg) { - sysPrxForUser.Warning("sys_spu_elf_get_segments(elf_img=0x%x, segments_addr=0x%x, nseg=0x%x)", elf_img, segments.GetAddr(), nseg); + sysPrxForUser->Warning("sys_spu_elf_get_segments(elf_img=0x%x, segments_addr=0x%x, nseg=0x%x)", elf_img, segments.GetAddr(), nseg); return CELL_OK; } int sys_spu_image_import(mem_ptr_t img, u32 src, u32 type) { - sysPrxForUser.Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=0x%x)", img.GetAddr(), src, type); + sysPrxForUser->Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=0x%x)", img.GetAddr(), src, type); if(!img.IsGood() || !Memory.IsGoodAddr(src)) { @@ -100,20 +101,20 @@ int sys_spu_image_import(mem_ptr_t img, u32 src, u32 type) int sys_spu_image_close(mem_ptr_t img) { - sysPrxForUser.Warning("sys_spu_image_close(img=0x%x)", img.GetAddr()); + sysPrxForUser->Warning("sys_spu_image_close(img=0x%x)", img.GetAddr()); return CELL_OK; } int sys_raw_spu_load(int id, u32 path_addr, mem32_t entry) { const std::string path = Memory.ReadString(path_addr); - sysPrxForUser.Warning("sys_raw_spu_load(id=0x%x, path=0x%x [%s], entry_addr=0x%x)", + sysPrxForUser->Warning("sys_raw_spu_load(id=0x%x, path=0x%x [%s], entry_addr=0x%x)", id, path_addr, path.c_str(), entry.GetAddr()); vfsFile f(path); if(!f.IsOpened()) { - sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path.c_str()); + sysPrxForUser->Error("sys_raw_spu_load error: '%s' not found!", path.c_str()); return CELL_ENOENT; } @@ -128,7 +129,7 @@ int sys_raw_spu_load(int id, u32 path_addr, mem32_t entry) int sys_raw_spu_image_load(int id, mem_ptr_t img) { - sysPrxForUser.Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.GetAddr()); + sysPrxForUser->Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.GetAddr()); Memory.Copy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, (u32)img->segs_addr, 256 * 1024); Memory.Write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs, @@ -139,66 +140,66 @@ int sys_raw_spu_image_load(int id, mem_ptr_t img) void sysPrxForUser_init() { - sysPrxForUser.AddFunc(0x744680a2, sys_initialize_tls); + sysPrxForUser->AddFunc(0x744680a2, sys_initialize_tls); - sysPrxForUser.AddFunc(0x2f85c0ef, sys_lwmutex_create); - sysPrxForUser.AddFunc(0xc3476d0c, sys_lwmutex_destroy); - sysPrxForUser.AddFunc(0x1573dc3f, sys_lwmutex_lock); - sysPrxForUser.AddFunc(0xaeb78725, sys_lwmutex_trylock); - sysPrxForUser.AddFunc(0x1bc200f4, sys_lwmutex_unlock); + sysPrxForUser->AddFunc(0x2f85c0ef, sys_lwmutex_create); + sysPrxForUser->AddFunc(0xc3476d0c, sys_lwmutex_destroy); + sysPrxForUser->AddFunc(0x1573dc3f, sys_lwmutex_lock); + sysPrxForUser->AddFunc(0xaeb78725, sys_lwmutex_trylock); + sysPrxForUser->AddFunc(0x1bc200f4, sys_lwmutex_unlock); - sysPrxForUser.AddFunc(0x8461e528, sys_time_get_system_time); + sysPrxForUser->AddFunc(0x8461e528, sys_time_get_system_time); - sysPrxForUser.AddFunc(0xe6f2c1e7, sys_process_exit); - sysPrxForUser.AddFunc(0x2c847572, sys_process_atexitspawn); - sysPrxForUser.AddFunc(0x96328741, sys_process_at_Exitspawn); - sysPrxForUser.AddFunc(0x4f7172c9, sys_process_is_stack); + sysPrxForUser->AddFunc(0xe6f2c1e7, sys_process_exit); + sysPrxForUser->AddFunc(0x2c847572, sys_process_atexitspawn); + sysPrxForUser->AddFunc(0x96328741, sys_process_at_Exitspawn); + sysPrxForUser->AddFunc(0x4f7172c9, sys_process_is_stack); - sysPrxForUser.AddFunc(0x24a1ea07, sys_ppu_thread_create); - sysPrxForUser.AddFunc(0x350d454e, sys_ppu_thread_get_id); - sysPrxForUser.AddFunc(0xaff080a4, sys_ppu_thread_exit); - sysPrxForUser.AddFunc(0xa3e3be68, sys_ppu_thread_once); + sysPrxForUser->AddFunc(0x24a1ea07, sys_ppu_thread_create); + sysPrxForUser->AddFunc(0x350d454e, sys_ppu_thread_get_id); + sysPrxForUser->AddFunc(0xaff080a4, sys_ppu_thread_exit); + sysPrxForUser->AddFunc(0xa3e3be68, sys_ppu_thread_once); - sysPrxForUser.AddFunc(0x45fe2fce, sys_spu_printf_initialize); + sysPrxForUser->AddFunc(0x45fe2fce, sys_spu_printf_initialize); - sysPrxForUser.AddFunc(0x42b23552, sys_prx_register_library); - sysPrxForUser.AddFunc(0xa2c7ba64, sys_prx_exitspawn_with_level); + sysPrxForUser->AddFunc(0x42b23552, sys_prx_register_library); + sysPrxForUser->AddFunc(0xa2c7ba64, sys_prx_exitspawn_with_level); - sysPrxForUser.AddFunc(0x2d36462b, sys_strlen); + sysPrxForUser->AddFunc(0x2d36462b, sys_strlen); - sysPrxForUser.AddFunc(0x35168520, sys_heap_malloc); - //sysPrxForUser.AddFunc(0xaede4b03, sys_heap_free); - //sysPrxForUser.AddFunc(0x8a561d92, sys_heap_delete_heap); - sysPrxForUser.AddFunc(0xb2fcf2c8, sys_heap_create_heap); - sysPrxForUser.AddFunc(0x44265c08, _sys_heap_memalign); + sysPrxForUser->AddFunc(0x35168520, sys_heap_malloc); + //sysPrxForUser->AddFunc(0xaede4b03, sys_heap_free); + //sysPrxForUser->AddFunc(0x8a561d92, sys_heap_delete_heap); + sysPrxForUser->AddFunc(0xb2fcf2c8, sys_heap_create_heap); + sysPrxForUser->AddFunc(0x44265c08, _sys_heap_memalign); - sysPrxForUser.AddFunc(0xb257540b, sys_mmapper_allocate_memory); - sysPrxForUser.AddFunc(0x70258515, sys_mmapper_allocate_memory_from_container); - sysPrxForUser.AddFunc(0xdc578057, sys_mmapper_map_memory); - sysPrxForUser.AddFunc(0x4643ba6e, sys_mmapper_unmap_memory); - sysPrxForUser.AddFunc(0x409ad939, sys_mmapper_free_memory); + sysPrxForUser->AddFunc(0xb257540b, sys_mmapper_allocate_memory); + sysPrxForUser->AddFunc(0x70258515, sys_mmapper_allocate_memory_from_container); + sysPrxForUser->AddFunc(0xdc578057, sys_mmapper_map_memory); + sysPrxForUser->AddFunc(0x4643ba6e, sys_mmapper_unmap_memory); + sysPrxForUser->AddFunc(0x409ad939, sys_mmapper_free_memory); - sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information); - sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments); - sysPrxForUser.AddFunc(0xebe5f72f, sys_spu_image_import); - sysPrxForUser.AddFunc(0xe0da8efd, sys_spu_image_close); + sysPrxForUser->AddFunc(0x1ed454ce, sys_spu_elf_get_information); + sysPrxForUser->AddFunc(0xdb6b3250, sys_spu_elf_get_segments); + sysPrxForUser->AddFunc(0xebe5f72f, sys_spu_image_import); + sysPrxForUser->AddFunc(0xe0da8efd, sys_spu_image_close); - sysPrxForUser.AddFunc(0x893305fa, sys_raw_spu_load); - sysPrxForUser.AddFunc(0xb995662e, sys_raw_spu_image_load); + sysPrxForUser->AddFunc(0x893305fa, sys_raw_spu_load); + sysPrxForUser->AddFunc(0xb995662e, sys_raw_spu_image_load); - sysPrxForUser.AddFunc(0xda0eb71a, sys_lwcond_create); - sysPrxForUser.AddFunc(0x1c9a942c, sys_lwcond_destroy); - sysPrxForUser.AddFunc(0xef87a695, sys_lwcond_signal); - sysPrxForUser.AddFunc(0xe9a1bd84, sys_lwcond_signal_all); - sysPrxForUser.AddFunc(0x52aadadf, sys_lwcond_signal_to); - sysPrxForUser.AddFunc(0x2a6d9d51, sys_lwcond_wait); + sysPrxForUser->AddFunc(0xda0eb71a, sys_lwcond_create); + sysPrxForUser->AddFunc(0x1c9a942c, sys_lwcond_destroy); + sysPrxForUser->AddFunc(0xef87a695, sys_lwcond_signal); + sysPrxForUser->AddFunc(0xe9a1bd84, sys_lwcond_signal_all); + sysPrxForUser->AddFunc(0x52aadadf, sys_lwcond_signal_to); + sysPrxForUser->AddFunc(0x2a6d9d51, sys_lwcond_wait); - sysPrxForUser.AddFunc(0x8c2bb498, sys_spinlock_initialize); - sysPrxForUser.AddFunc(0xa285139d, sys_spinlock_lock); - sysPrxForUser.AddFunc(0x722a0254, sys_spinlock_trylock); - sysPrxForUser.AddFunc(0x5267cb35, sys_spinlock_unlock); + sysPrxForUser->AddFunc(0x8c2bb498, sys_spinlock_initialize); + sysPrxForUser->AddFunc(0xa285139d, sys_spinlock_lock); + sysPrxForUser->AddFunc(0x722a0254, sys_spinlock_trylock); + sysPrxForUser->AddFunc(0x5267cb35, sys_spinlock_unlock); - sysPrxForUser.AddFunc(0x67f9fedb, sys_game_process_exitspawn2); - sysPrxForUser.AddFunc(0xfc52a7a9, sys_game_process_exitspawn); + sysPrxForUser->AddFunc(0x67f9fedb, sys_game_process_exitspawn2); + sysPrxForUser->AddFunc(0xfc52a7a9, sys_game_process_exitspawn); } diff --git a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp index 6895aea967..6fa451d26e 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_fs.cpp @@ -6,8 +6,9 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" -void sys_fs_init(); -Module sys_fs(0x000e, sys_fs_init); +//void sys_fs_init(); +//Module sys_fs(0x000e, sys_fs_init); +Module *sys_fs = nullptr; bool sdata_check(u32 version, u32 flags, u64 filesizeInput, u64 filesizeTmp) { @@ -42,13 +43,13 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil if(!packed_stream || !packed_stream->IsOpened()) { - sys_fs.Error("'%s' not found! flags: 0x%08x", packed_file.c_str(), vfsRead); + sys_fs->Error("'%s' not found! flags: 0x%08x", packed_file.c_str(), vfsRead); return CELL_ENOENT; } if(!unpacked_stream || !unpacked_stream->IsOpened()) { - sys_fs.Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.c_str(), vfsWrite); + sys_fs->Error("'%s' couldn't be created! flags: 0x%08x", unpacked_file.c_str(), vfsWrite); return CELL_ENOENT; } @@ -57,7 +58,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil u32 format = re32(*(u32*)&buffer[0]); if (format != 0x4E504400) // "NPD\x00" { - sys_fs.Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format); + sys_fs->Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format); return CELL_EFSSPECIFIC; } @@ -71,7 +72,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil // SDATA file is compressed if (flags & 0x1) { - sys_fs.Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet."); + sys_fs->Warning("cellFsSdataOpen: Compressed SDATA files are not supported yet."); return CELL_EFSSPECIFIC; } @@ -84,7 +85,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil if (!sdata_check(version, flags, filesizeInput, filesizeTmp)) { - sys_fs.Error("cellFsSdataOpen: Wrong header information."); + sys_fs->Error("cellFsSdataOpen: Wrong header information."); return CELL_EFSSPECIFIC; } @@ -113,7 +114,7 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) { const std::string& path = Memory.ReadString(path_addr); - sys_fs.Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)", + sys_fs->Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)", path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size); if (!fd.IsGood() || (!arg.IsGood() && size)) @@ -132,7 +133,7 @@ int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) int ret = sdata_unpack(path, unpacked_path); if (ret) return ret; - fd = sys_fs.GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), flags); + fd = sys_fs->GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), flags); return CELL_OK; } @@ -154,7 +155,7 @@ void fsAioRead(u32 fd, mem_ptr_t aio, int xid, mem_func_ptr_tCheckId(fd, orig_file)) return; u64 nbytes = aio->size; u32 buf_addr = aio->buf_addr; @@ -232,7 +233,7 @@ fin: int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_t xaio, int error, int xid, u64 size)> func) { - sys_fs.Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr()); + sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr()); if (!aio.IsGood() || !aio_id.IsGood() || !func.IsGood()) { @@ -246,7 +247,7 @@ int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_tfd; - if (!sys_fs.CheckId(fd, orig_file)) return CELL_EBADF; + if (!sys_fs->CheckId(fd, orig_file)) return CELL_EBADF; //get a unique id for the callback (may be used by cellFsAioCancel) const u32 xid = g_FsAioReadID++; @@ -263,7 +264,7 @@ int cellFsAioRead(mem_ptr_t aio, mem32_t aio_id, mem_func_ptr_tWarning("cellFsAioInit(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.c_str()); aio_init = true; return CELL_OK; } @@ -271,14 +272,14 @@ int cellFsAioInit(mem8_ptr_t mount_point) int cellFsAioFinish(mem8_ptr_t mount_point) { std::string mp = Memory.ReadString(mount_point.GetAddr()); - sys_fs.Warning("cellFsAioFinish(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.c_str()); + sys_fs->Warning("cellFsAioFinish(mount_point_addr=0x%x (%s))", mount_point.GetAddr(), mp.c_str()); aio_init = false; return CELL_OK; } int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, mem64_t nread) { - sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf_addr=0x%x, buffer_size=%lld nread=0x%llx)", + sys_fs->Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf_addr=0x%x, buffer_size=%lld nread=0x%llx)", fd, offset, buf_addr, buffer_size, nread.GetAddr()); int ret; @@ -297,43 +298,43 @@ int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, mem6 void sys_fs_init() { - sys_fs.AddFunc(0x718bf5f8, cellFsOpen); - sys_fs.AddFunc(0xb1840b53, cellFsSdataOpen); - sys_fs.AddFunc(0x4d5ff8e2, cellFsRead); - sys_fs.AddFunc(0xecdcf2ab, cellFsWrite); - sys_fs.AddFunc(0x2cb51f0d, cellFsClose); - sys_fs.AddFunc(0x3f61245c, cellFsOpendir); - sys_fs.AddFunc(0x5c74903d, cellFsReaddir); - sys_fs.AddFunc(0xff42dcc3, cellFsClosedir); - sys_fs.AddFunc(0x7de6dced, cellFsStat); - sys_fs.AddFunc(0xef3efa34, cellFsFstat); - sys_fs.AddFunc(0xba901fe6, cellFsMkdir); - sys_fs.AddFunc(0xf12eecc8, cellFsRename); - sys_fs.AddFunc(0x2796fdf3, cellFsRmdir); - sys_fs.AddFunc(0x7f4677a8, cellFsUnlink); - sys_fs.AddFunc(0xa397d042, cellFsLseek); - sys_fs.AddFunc(0x0e2939e5, cellFsFtruncate); - sys_fs.AddFunc(0xc9dc3ac5, cellFsTruncate); - sys_fs.AddFunc(0xcb588dba, cellFsFGetBlockSize); - sys_fs.AddFunc(0xc1c507e7, cellFsAioRead); - sys_fs.AddFunc(0xdb869f20, cellFsAioInit); - sys_fs.AddFunc(0x9f951810, cellFsAioFinish); - sys_fs.AddFunc(0x1a108ab7, cellFsGetBlockSize); - sys_fs.AddFunc(0xaa3b4bcd, cellFsGetFreeSize); - sys_fs.AddFunc(0x0d5b4a14, cellFsReadWithOffset); - sys_fs.AddFunc(0x9b882495, cellFsGetDirectoryEntries); - sys_fs.AddFunc(0x2664c8ae, cellFsStReadInit); - sys_fs.AddFunc(0xd73938df, cellFsStReadFinish); - sys_fs.AddFunc(0xb3afee8b, cellFsStReadGetRingBuf); - sys_fs.AddFunc(0xcf34969c, cellFsStReadGetStatus); - sys_fs.AddFunc(0xbd273a88, cellFsStReadGetRegid); - sys_fs.AddFunc(0x8df28ff9, cellFsStReadStart); - sys_fs.AddFunc(0xf8e5d9a0, cellFsStReadStop); - sys_fs.AddFunc(0x27800c6b, cellFsStRead); - sys_fs.AddFunc(0x190912f6, cellFsStReadGetCurrentAddr); - sys_fs.AddFunc(0x81f33783, cellFsStReadPutCurrentAddr); - sys_fs.AddFunc(0x8f71c5b2, cellFsStReadWait); - sys_fs.AddFunc(0x866f6aec, cellFsStReadWaitCallback); + sys_fs->AddFunc(0x718bf5f8, cellFsOpen); + sys_fs->AddFunc(0xb1840b53, cellFsSdataOpen); + sys_fs->AddFunc(0x4d5ff8e2, cellFsRead); + sys_fs->AddFunc(0xecdcf2ab, cellFsWrite); + sys_fs->AddFunc(0x2cb51f0d, cellFsClose); + sys_fs->AddFunc(0x3f61245c, cellFsOpendir); + sys_fs->AddFunc(0x5c74903d, cellFsReaddir); + sys_fs->AddFunc(0xff42dcc3, cellFsClosedir); + sys_fs->AddFunc(0x7de6dced, cellFsStat); + sys_fs->AddFunc(0xef3efa34, cellFsFstat); + sys_fs->AddFunc(0xba901fe6, cellFsMkdir); + sys_fs->AddFunc(0xf12eecc8, cellFsRename); + sys_fs->AddFunc(0x2796fdf3, cellFsRmdir); + sys_fs->AddFunc(0x7f4677a8, cellFsUnlink); + sys_fs->AddFunc(0xa397d042, cellFsLseek); + sys_fs->AddFunc(0x0e2939e5, cellFsFtruncate); + sys_fs->AddFunc(0xc9dc3ac5, cellFsTruncate); + sys_fs->AddFunc(0xcb588dba, cellFsFGetBlockSize); + sys_fs->AddFunc(0xc1c507e7, cellFsAioRead); + sys_fs->AddFunc(0xdb869f20, cellFsAioInit); + sys_fs->AddFunc(0x9f951810, cellFsAioFinish); + sys_fs->AddFunc(0x1a108ab7, cellFsGetBlockSize); + sys_fs->AddFunc(0xaa3b4bcd, cellFsGetFreeSize); + sys_fs->AddFunc(0x0d5b4a14, cellFsReadWithOffset); + sys_fs->AddFunc(0x9b882495, cellFsGetDirectoryEntries); + sys_fs->AddFunc(0x2664c8ae, cellFsStReadInit); + sys_fs->AddFunc(0xd73938df, cellFsStReadFinish); + sys_fs->AddFunc(0xb3afee8b, cellFsStReadGetRingBuf); + sys_fs->AddFunc(0xcf34969c, cellFsStReadGetStatus); + sys_fs->AddFunc(0xbd273a88, cellFsStReadGetRegid); + sys_fs->AddFunc(0x8df28ff9, cellFsStReadStart); + sys_fs->AddFunc(0xf8e5d9a0, cellFsStReadStop); + sys_fs->AddFunc(0x27800c6b, cellFsStRead); + sys_fs->AddFunc(0x190912f6, cellFsStReadGetCurrentAddr); + sys_fs->AddFunc(0x81f33783, cellFsStReadPutCurrentAddr); + sys_fs->AddFunc(0x8f71c5b2, cellFsStReadWait); + sys_fs->AddFunc(0x866f6aec, cellFsStReadWaitCallback); aio_init = false; } diff --git a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp index 5a0fb41e8c..031dc065a2 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp @@ -6,45 +6,46 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" -void sys_io_init(); -Module sys_io(0x0017, sys_io_init); +//void sys_io_init(); +//Module sys_io(0x0017, sys_io_init); +Module *sys_io = nullptr; void sys_io_init() { - sys_io.AddFunc(0x1cf98800, cellPadInit); - sys_io.AddFunc(0x4d9b75d5, cellPadEnd); - sys_io.AddFunc(0x0d5f2c14, cellPadClearBuf); - sys_io.AddFunc(0x8b72cda1, cellPadGetData); - sys_io.AddFunc(0x6bc09c61, cellPadGetDataExtra); - sys_io.AddFunc(0xf65544ee, cellPadSetActDirect); - sys_io.AddFunc(0x3aaad464, cellPadGetInfo); - sys_io.AddFunc(0xa703a51d, cellPadGetInfo2); - sys_io.AddFunc(0x578e3c98, cellPadSetPortSetting); - sys_io.AddFunc(0x0e2dfaad, cellPadInfoPressMode); - sys_io.AddFunc(0x78200559, cellPadInfoSensorMode); - sys_io.AddFunc(0xf83f8182, cellPadSetPressMode); - sys_io.AddFunc(0xbe5be3ba, cellPadSetSensorMode); - sys_io.AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo); + sys_io->AddFunc(0x1cf98800, cellPadInit); + sys_io->AddFunc(0x4d9b75d5, cellPadEnd); + sys_io->AddFunc(0x0d5f2c14, cellPadClearBuf); + sys_io->AddFunc(0x8b72cda1, cellPadGetData); + sys_io->AddFunc(0x6bc09c61, cellPadGetDataExtra); + sys_io->AddFunc(0xf65544ee, cellPadSetActDirect); + sys_io->AddFunc(0x3aaad464, cellPadGetInfo); + sys_io->AddFunc(0xa703a51d, cellPadGetInfo2); + sys_io->AddFunc(0x578e3c98, cellPadSetPortSetting); + sys_io->AddFunc(0x0e2dfaad, cellPadInfoPressMode); + sys_io->AddFunc(0x78200559, cellPadInfoSensorMode); + sys_io->AddFunc(0xf83f8182, cellPadSetPressMode); + sys_io->AddFunc(0xbe5be3ba, cellPadSetSensorMode); + sys_io->AddFunc(0xdbf4c59c, cellPadGetCapabilityInfo); - sys_io.AddFunc(0x433f6ec0, cellKbInit); - sys_io.AddFunc(0xbfce3285, cellKbEnd); - sys_io.AddFunc(0x2073b7f6, cellKbClearBuf); - sys_io.AddFunc(0x4ab1fa77, cellKbCnvRawCode); - sys_io.AddFunc(0x2f1774d5, cellKbGetInfo); - sys_io.AddFunc(0xff0a21b7, cellKbRead); - sys_io.AddFunc(0xa5f85e4d, cellKbSetCodeType); - sys_io.AddFunc(0x3f72c56e, cellKbSetLEDStatus); - sys_io.AddFunc(0xdeefdfa7, cellKbSetReadMode); - sys_io.AddFunc(0x1f71ecbe, cellKbGetConfiguration); + sys_io->AddFunc(0x433f6ec0, cellKbInit); + sys_io->AddFunc(0xbfce3285, cellKbEnd); + sys_io->AddFunc(0x2073b7f6, cellKbClearBuf); + sys_io->AddFunc(0x4ab1fa77, cellKbCnvRawCode); + sys_io->AddFunc(0x2f1774d5, cellKbGetInfo); + sys_io->AddFunc(0xff0a21b7, cellKbRead); + sys_io->AddFunc(0xa5f85e4d, cellKbSetCodeType); + sys_io->AddFunc(0x3f72c56e, cellKbSetLEDStatus); + sys_io->AddFunc(0xdeefdfa7, cellKbSetReadMode); + sys_io->AddFunc(0x1f71ecbe, cellKbGetConfiguration); - sys_io.AddFunc(0xc9030138, cellMouseInit); - sys_io.AddFunc(0x3ef66b95, cellMouseClearBuf); - sys_io.AddFunc(0xe10183ce, cellMouseEnd); - sys_io.AddFunc(0x5baf30fb, cellMouseGetInfo); - sys_io.AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode); - sys_io.AddFunc(0x3138e632, cellMouseGetData); - sys_io.AddFunc(0x6bd131f0, cellMouseGetDataList); - sys_io.AddFunc(0x2d16da4f, cellMouseSetTabletMode); - sys_io.AddFunc(0x21a62e9b, cellMouseGetTabletDataList); - sys_io.AddFunc(0xa328cc35, cellMouseGetRawData); + sys_io->AddFunc(0xc9030138, cellMouseInit); + sys_io->AddFunc(0x3ef66b95, cellMouseClearBuf); + sys_io->AddFunc(0xe10183ce, cellMouseEnd); + sys_io->AddFunc(0x5baf30fb, cellMouseGetInfo); + sys_io->AddFunc(0x4d0b3b1f, cellMouseInfoTabletMode); + sys_io->AddFunc(0x3138e632, cellMouseGetData); + sys_io->AddFunc(0x6bd131f0, cellMouseGetDataList); + sys_io->AddFunc(0x2d16da4f, cellMouseSetTabletMode); + sys_io->AddFunc(0x21a62e9b, cellMouseGetTabletDataList); + sys_io->AddFunc(0xa328cc35, cellMouseGetRawData); } diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index 7285e27201..af0c53c620 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -20,8 +20,9 @@ extern "C" } #endif -void sys_net_init(); -Module sys_net((u16)0x0000, sys_net_init); +//void sys_net_init(); +//Module sys_net((u16)0x0000, sys_net_init); +Module *sys_net = nullptr; mem32_t g_lastError(0); @@ -98,7 +99,7 @@ using pck_len_t = u32; // Functions int sys_net_accept(s32 s, mem_ptr_t addr, mem32_t paddrlen) { - sys_net.Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.GetAddr(), paddrlen.GetAddr()); + sys_net->Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.GetAddr(), paddrlen.GetAddr()); if (addr.GetAddr() == 0) { int ret = accept(s, NULL, NULL); g_lastError = getLastError(); @@ -117,12 +118,12 @@ int sys_net_accept(s32 s, mem_ptr_t addr, mem32_t paddrlen) int sys_net_bind(s32 s, mem_ptr_t addr, u32 addrlen) { - sys_net.Warning("bind(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.GetAddr(), addrlen); + sys_net->Warning("bind(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.GetAddr(), addrlen); sockaddr_in saddr; memcpy(&saddr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr_in)); saddr.sin_family = addr->sin_family; const char *ipaddr = inet_ntoa(saddr.sin_addr); - sys_net.Warning("binding on %s to port %d", ipaddr, ntohs(saddr.sin_port)); + sys_net->Warning("binding on %s to port %d", ipaddr, ntohs(saddr.sin_port)); int ret = bind(s, (const sockaddr *)&saddr, addrlen); g_lastError = getLastError(); return ret; @@ -130,12 +131,12 @@ int sys_net_bind(s32 s, mem_ptr_t addr, u32 addrlen) int sys_net_connect(s32 s, mem_ptr_t addr, u32 addrlen) { - sys_net.Warning("connect(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.GetAddr(), addrlen); + sys_net->Warning("connect(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.GetAddr(), addrlen); sockaddr_in saddr; memcpy(&saddr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr_in)); saddr.sin_family = addr->sin_family; const char *ipaddr = inet_ntoa(saddr.sin_addr); - sys_net.Warning("connecting on %s to port %d", ipaddr, ntohs(saddr.sin_port)); + sys_net->Warning("connecting on %s to port %d", ipaddr, ntohs(saddr.sin_port)); int ret = connect(s, (const sockaddr *) &saddr, addrlen); g_lastError = getLastError(); return ret; @@ -174,7 +175,7 @@ int getsockopt() int sys_net_inet_addr(mem8_ptr_t cp) { std::string cp_ = Memory.ReadString(cp.GetAddr()); - sys_net.Warning("inet_addr(cp=\"%s\")", cp_.c_str()); + sys_net->Warning("inet_addr(cp=\"%s\")", cp_.c_str()); return htonl(inet_addr(cp_.c_str())); // return a big-endian IP address } @@ -222,7 +223,7 @@ int inet_ntop() int sys_net_inet_pton(s32 af, u32 src_addr, u32 dst_addr) { - sys_net.Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src_addr, dst_addr); + sys_net->Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src_addr, dst_addr); char *src = (char *)Memory.VirtualToRealAddr(src_addr); char *dst = (char *)Memory.VirtualToRealAddr(dst_addr); return inet_pton(af, src, dst); @@ -230,7 +231,7 @@ int sys_net_inet_pton(s32 af, u32 src_addr, u32 dst_addr) int sys_net_listen(s32 s, s32 backlog) { - sys_net.Warning("listen(s=%d, backlog=%d)", s, backlog); + sys_net->Warning("listen(s=%d, backlog=%d)", s, backlog); int ret = listen(s, backlog); g_lastError = getLastError(); return ret; @@ -238,7 +239,7 @@ int sys_net_listen(s32 s, s32 backlog) int sys_net_recv(s32 s, u32 buf_addr, u32 len, s32 flags) { - sys_net.Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags); + sys_net->Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags); char *buf = (char *)Memory.VirtualToRealAddr(buf_addr); int ret = recv(s, buf, len, flags); g_lastError = getLastError(); @@ -247,7 +248,7 @@ int sys_net_recv(s32 s, u32 buf_addr, u32 len, s32 flags) int sys_net_recvfrom(s32 s, u32 buf_addr, u32 len, s32 flags, mem_ptr_t addr, mem32_t paddrlen) { - sys_net.Warning("recvfrom(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)", + sys_net->Warning("recvfrom(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)", s, buf_addr, len, flags, addr.GetAddr(), paddrlen.GetAddr()); char *_buf_addr = (char *)Memory.VirtualToRealAddr(buf_addr); @@ -268,7 +269,7 @@ int recvmsg() int sys_net_send(s32 s, u32 buf_addr, u32 len, s32 flags) { - sys_net.Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags); + sys_net->Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags); char *buf = (char *)Memory.VirtualToRealAddr(buf_addr); int ret = send(s, buf, len, flags); g_lastError = getLastError(); @@ -283,7 +284,7 @@ int sendmsg() int sys_net_sendto(s32 s, u32 buf_addr, u32 len, s32 flags, mem_ptr_t addr, u32 addrlen) { - sys_net.Warning("sendto(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr=0x%x, addrlen=%u)", + sys_net->Warning("sendto(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr=0x%x, addrlen=%u)", s, buf_addr, len, flags, addr.GetAddr(), addrlen); char *_buf_addr = (char *)Memory.VirtualToRealAddr(buf_addr); @@ -297,7 +298,7 @@ int sys_net_sendto(s32 s, u32 buf_addr, u32 len, s32 flags, mem_ptr_tWarning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%u)", s, level, optname, optval_addr, optlen); char *_optval_addr = (char *)Memory.VirtualToRealAddr(optval_addr); int ret = setsockopt(s, level, optname, _optval_addr, optlen); g_lastError = getLastError(); @@ -306,7 +307,7 @@ int sys_net_setsockopt(s32 s, s32 level, s32 optname, u32 optval_addr, u32 optle int sys_net_shutdown(s32 s, s32 how) { - sys_net.Warning("shutdown(s=%d, how=%d)", s, how); + sys_net->Warning("shutdown(s=%d, how=%d)", s, how); int ret = shutdown(s, how); g_lastError = getLastError(); return ret; @@ -314,7 +315,7 @@ int sys_net_shutdown(s32 s, s32 how) int sys_net_socket(s32 family, s32 type, s32 protocol) { - sys_net.Warning("socket(family=%d, type=%d, protocol=%d)", family, type, protocol); + sys_net->Warning("socket(family=%d, type=%d, protocol=%d)", family, type, protocol); int ret = socket(family, type, protocol); g_lastError = getLastError(); return ret; @@ -322,7 +323,7 @@ int sys_net_socket(s32 family, s32 type, s32 protocol) int sys_net_socketclose(s32 s) { - sys_net.Warning("socket(s=%d)", s); + sys_net->Warning("socket(s=%d)", s); #ifdef _WIN32 int ret = closesocket(s); #else @@ -346,7 +347,7 @@ int socketselect() int sys_net_initialize_network_ex(mem_ptr_t param) { - sys_net.Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.GetAddr()); + sys_net->Warning("sys_net_initialize_network_ex(param_addr=0x%x)", param.GetAddr()); g_lastError.SetAddr(Memory.Alloc(4, 1)); #ifdef _WIN32 WSADATA wsaData; @@ -412,7 +413,7 @@ int sys_net_show_nameserver() s32 _sys_net_errno_loc() { - sys_net.Warning("_sys_net_errno_loc()"); + sys_net->Warning("_sys_net_errno_loc()"); return g_lastError.GetAddr(); } @@ -478,7 +479,7 @@ int sys_net_show_ifconfig() int sys_net_finalize_network() { - sys_net.Warning("sys_net_initialize_network_ex()"); + sys_net->Warning("sys_net_initialize_network_ex()"); Memory.Free(g_lastError.GetAddr()); g_lastError.SetAddr(0); #ifdef _WIN32 @@ -508,62 +509,62 @@ int sys_net_free_thread_context() void sys_net_init() { // The names of the following functions are modified to avoid overloading problems - sys_net.AddFunc(0xc94f6939, sys_net_accept); - sys_net.AddFunc(0xb0a59804, sys_net_bind); - sys_net.AddFunc(0x64f66d35, sys_net_connect); - //sys_net.AddFunc(0xf7ac8941, sys_net_gethostbyaddr); - //sys_net.AddFunc(0x71f4c717, sys_net_gethostbyname); - //sys_net.AddFunc(0xf9ec2db6, sys_net_getpeername); - //sys_net.AddFunc(0x13efe7f5, sys_net_getsockname); - //sys_net.AddFunc(0x5a045bd1, sys_net_getsockopt); - sys_net.AddFunc(0xdabbc2c0, sys_net_inet_addr); - //sys_net.AddFunc(0xa9a079e0, sys_net_inet_aton); - //sys_net.AddFunc(0x566893ce, sys_net_inet_lnaof); - //sys_net.AddFunc(0xb4152c74, sys_net_inet_makeaddr); - //sys_net.AddFunc(0xe39a62a7, sys_net_inet_netof); - //sys_net.AddFunc(0x506ad863, sys_net_inet_network); - //sys_net.AddFunc(0x858a930b, sys_net_inet_ntoa); - //sys_net.AddFunc(0xc98a3146, sys_net_inet_ntop); - sys_net.AddFunc(0x8af3825e, sys_net_inet_pton); - sys_net.AddFunc(0x28e208bb, sys_net_listen); - //sys_net.AddFunc(, sys_net_ntohl); - //sys_net.AddFunc(, sys_net_ntohs); - sys_net.AddFunc(0xfba04f37, sys_net_recv); - sys_net.AddFunc(0x1f953b9f, sys_net_recvfrom); - //sys_net.AddFunc(0xc9d09c34, sys_net_recvmsg); - sys_net.AddFunc(0xdc751b40, sys_net_send); - //sys_net.AddFunc(0xad09481b, sys_net_sendmsg); - sys_net.AddFunc(0x9647570b, sys_net_sendto); - sys_net.AddFunc(0x88f03575, sys_net_setsockopt); - sys_net.AddFunc(0xa50777c6, sys_net_shutdown); - sys_net.AddFunc(0x9c056962, sys_net_socket); - sys_net.AddFunc(0x6db6e8cd, sys_net_socketclose); - //sys_net.AddFunc(0x051ee3ee, sys_net_socketpoll); - //sys_net.AddFunc(0x3f09e20a, sys_net_socketselect); + sys_net->AddFunc(0xc94f6939, sys_net_accept); + sys_net->AddFunc(0xb0a59804, sys_net_bind); + sys_net->AddFunc(0x64f66d35, sys_net_connect); + //sys_net->AddFunc(0xf7ac8941, sys_net_gethostbyaddr); + //sys_net->AddFunc(0x71f4c717, sys_net_gethostbyname); + //sys_net->AddFunc(0xf9ec2db6, sys_net_getpeername); + //sys_net->AddFunc(0x13efe7f5, sys_net_getsockname); + //sys_net->AddFunc(0x5a045bd1, sys_net_getsockopt); + sys_net->AddFunc(0xdabbc2c0, sys_net_inet_addr); + //sys_net->AddFunc(0xa9a079e0, sys_net_inet_aton); + //sys_net->AddFunc(0x566893ce, sys_net_inet_lnaof); + //sys_net->AddFunc(0xb4152c74, sys_net_inet_makeaddr); + //sys_net->AddFunc(0xe39a62a7, sys_net_inet_netof); + //sys_net->AddFunc(0x506ad863, sys_net_inet_network); + //sys_net->AddFunc(0x858a930b, sys_net_inet_ntoa); + //sys_net->AddFunc(0xc98a3146, sys_net_inet_ntop); + sys_net->AddFunc(0x8af3825e, sys_net_inet_pton); + sys_net->AddFunc(0x28e208bb, sys_net_listen); + //sys_net->AddFunc(, sys_net_ntohl); + //sys_net->AddFunc(, sys_net_ntohs); + sys_net->AddFunc(0xfba04f37, sys_net_recv); + sys_net->AddFunc(0x1f953b9f, sys_net_recvfrom); + //sys_net->AddFunc(0xc9d09c34, sys_net_recvmsg); + sys_net->AddFunc(0xdc751b40, sys_net_send); + //sys_net->AddFunc(0xad09481b, sys_net_sendmsg); + sys_net->AddFunc(0x9647570b, sys_net_sendto); + sys_net->AddFunc(0x88f03575, sys_net_setsockopt); + sys_net->AddFunc(0xa50777c6, sys_net_shutdown); + sys_net->AddFunc(0x9c056962, sys_net_socket); + sys_net->AddFunc(0x6db6e8cd, sys_net_socketclose); + //sys_net->AddFunc(0x051ee3ee, sys_net_socketpoll); + //sys_net->AddFunc(0x3f09e20a, sys_net_socketselect); - sys_net.AddFunc(0x139a9e9b, sys_net_initialize_network_ex); - sys_net.AddFunc(0x05bd4438, sys_net_get_udpp2p_test_param); - sys_net.AddFunc(0x10b81ed6, sys_net_set_udpp2p_test_param); - sys_net.AddFunc(0x1d14d6e4, sys_net_get_lib_name_server); - sys_net.AddFunc(0x27fb339d, sys_net_if_ctl); - sys_net.AddFunc(0x368823c0, sys_net_get_netemu_test_param); - sys_net.AddFunc(0x3b27c780, sys_net_get_sockinfo); - sys_net.AddFunc(0x44328aa2, sys_net_close_dump); - sys_net.AddFunc(0x4ab0b9b9, sys_net_set_test_param); - sys_net.AddFunc(0x5420e419, sys_net_show_nameserver); - sys_net.AddFunc(0x6005cde1, _sys_net_errno_loc); - sys_net.AddFunc(0x7687d48c, sys_net_set_resolver_configurations); - sys_net.AddFunc(0x79b61646, sys_net_show_route); - sys_net.AddFunc(0x89c9917c, sys_net_read_dump); - sys_net.AddFunc(0x8ccf05ed, sys_net_abort_resolver); - sys_net.AddFunc(0x8d1b77fb, sys_net_abort_socket); - sys_net.AddFunc(0x9a318259, sys_net_set_lib_name_server); - sys_net.AddFunc(0xa5a86557, sys_net_get_test_param); - sys_net.AddFunc(0xa765d029, sys_net_get_sockinfo_ex); - sys_net.AddFunc(0xab447704, sys_net_open_dump); - sys_net.AddFunc(0xb48636c4, sys_net_show_ifconfig); - sys_net.AddFunc(0xb68d5625, sys_net_finalize_network); - sys_net.AddFunc(0xc9157d30, _sys_net_h_errno_loc); - sys_net.AddFunc(0xe2434507, sys_net_set_netemu_test_param); - sys_net.AddFunc(0xfdb8f926, sys_net_free_thread_context); + sys_net->AddFunc(0x139a9e9b, sys_net_initialize_network_ex); + sys_net->AddFunc(0x05bd4438, sys_net_get_udpp2p_test_param); + sys_net->AddFunc(0x10b81ed6, sys_net_set_udpp2p_test_param); + sys_net->AddFunc(0x1d14d6e4, sys_net_get_lib_name_server); + sys_net->AddFunc(0x27fb339d, sys_net_if_ctl); + sys_net->AddFunc(0x368823c0, sys_net_get_netemu_test_param); + sys_net->AddFunc(0x3b27c780, sys_net_get_sockinfo); + sys_net->AddFunc(0x44328aa2, sys_net_close_dump); + sys_net->AddFunc(0x4ab0b9b9, sys_net_set_test_param); + sys_net->AddFunc(0x5420e419, sys_net_show_nameserver); + sys_net->AddFunc(0x6005cde1, _sys_net_errno_loc); + sys_net->AddFunc(0x7687d48c, sys_net_set_resolver_configurations); + sys_net->AddFunc(0x79b61646, sys_net_show_route); + sys_net->AddFunc(0x89c9917c, sys_net_read_dump); + sys_net->AddFunc(0x8ccf05ed, sys_net_abort_resolver); + sys_net->AddFunc(0x8d1b77fb, sys_net_abort_socket); + sys_net->AddFunc(0x9a318259, sys_net_set_lib_name_server); + sys_net->AddFunc(0xa5a86557, sys_net_get_test_param); + sys_net->AddFunc(0xa765d029, sys_net_get_sockinfo_ex); + sys_net->AddFunc(0xab447704, sys_net_open_dump); + sys_net->AddFunc(0xb48636c4, sys_net_show_ifconfig); + sys_net->AddFunc(0xb68d5625, sys_net_finalize_network); + sys_net->AddFunc(0xc9157d30, _sys_net_h_errno_loc); + sys_net->AddFunc(0xe2434507, sys_net_set_netemu_test_param); + sys_net->AddFunc(0xfdb8f926, sys_net_free_thread_context); } diff --git a/rpcs3/Emu/SysCalls/Static.cpp b/rpcs3/Emu/SysCalls/Static.cpp index 789b38aee3..21d70269d3 100644 --- a/rpcs3/Emu/SysCalls/Static.cpp +++ b/rpcs3/Emu/SysCalls/Static.cpp @@ -5,10 +5,9 @@ #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" +#include "Static.h" -extern std::vector g_static_funcs_list; - -void StaticAnalyse(void* ptr, u32 size, u32 base) +void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) { u32* data = (u32*)ptr; size /= 4; @@ -18,13 +17,13 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) // TODO: optimize search for (u32 i = 0; i < size; i++) { - for (u32 j = 0; j < g_static_funcs_list.size(); j++) + for (u32 j = 0; j < m_static_funcs_list.size(); j++) { - if ((data[i] & g_static_funcs_list[j]->ops[0].mask) == g_static_funcs_list[j]->ops[0].crc) + if ((data[i] & m_static_funcs_list[j]->ops[0].mask) == m_static_funcs_list[j]->ops[0].crc) { bool found = true; u32 can_skip = 0; - for (u32 k = i, x = 0; x + 1 <= g_static_funcs_list[j]->ops.size(); k++, x++) + for (u32 k = i, x = 0; x + 1 <= m_static_funcs_list[j]->ops.size(); k++, x++) { if (k >= size) { @@ -39,8 +38,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) continue; } - const u32 mask = g_static_funcs_list[j]->ops[x].mask; - const u32 crc = g_static_funcs_list[j]->ops[x].crc; + const u32 mask = m_static_funcs_list[j]->ops[x].mask; + const u32 crc = m_static_funcs_list[j]->ops[x].crc; if (!mask) { @@ -86,8 +85,8 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) } if (found) { - ConLog.Write("Function '%s' hooked (addr=0x%x)", g_static_funcs_list[j]->name, i * 4 + base); - g_static_funcs_list[j]->found++; + ConLog.Write("Function '%s' hooked (addr=0x%x)", m_static_funcs_list[j]->name, i * 4 + base); + m_static_funcs_list[j]->found++; data[i+0] = re32(0x39600000 | j); // li r11, j data[i+1] = se32(0x44000003); // sc 3 data[i+2] = se32(0x4e800020); // blr @@ -98,11 +97,11 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) } // check function groups - for (u32 i = 0; i < g_static_funcs_list.size(); i++) + for (u32 i = 0; i < m_static_funcs_list.size(); i++) { - if (g_static_funcs_list[i]->found) // start from some group + if (m_static_funcs_list[i]->found) // start from some group { - const u64 group = g_static_funcs_list[i]->group; + const u64 group = m_static_funcs_list[i]->group; enum GroupSearchResult : u32 { @@ -113,24 +112,24 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) u32 res = GSR_SUCCESS; // analyse - for (u32 j = 0; j < g_static_funcs_list.size(); j++) if (g_static_funcs_list[j]->group == group) + for (u32 j = 0; j < m_static_funcs_list.size(); j++) if (m_static_funcs_list[j]->group == group) { - u32 count = g_static_funcs_list[j]->found; + u32 count = m_static_funcs_list[j]->found; if (count == 0) // not found { // check if this function has been found with different pattern - for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group) + for (u32 k = 0; k < m_static_funcs_list.size(); k++) if (m_static_funcs_list[k]->group == group) { - if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr) + if (k != j && m_static_funcs_list[k]->ptr == m_static_funcs_list[j]->ptr) { - count += g_static_funcs_list[k]->found; + count += m_static_funcs_list[k]->found; } } if (count == 0) { res |= GSR_MISSING; - ConLog.Error("Function '%s' not found", g_static_funcs_list[j]->name); + ConLog.Error("Function '%s' not found", m_static_funcs_list[j]->name); } else if (count > 1) { @@ -140,14 +139,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) else if (count == 1) // found { // ensure that this function has NOT been found with different pattern - for (u32 k = 0; k < g_static_funcs_list.size(); k++) if (g_static_funcs_list[k]->group == group) + for (u32 k = 0; k < m_static_funcs_list.size(); k++) if (m_static_funcs_list[k]->group == group) { - if (k != j && g_static_funcs_list[k]->ptr == g_static_funcs_list[j]->ptr) + if (k != j && m_static_funcs_list[k]->ptr == m_static_funcs_list[j]->ptr) { - if (g_static_funcs_list[k]->found) + if (m_static_funcs_list[k]->found) { res |= GSR_EXCESS; - ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name); + ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name); } } } @@ -155,14 +154,14 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) else { res |= GSR_EXCESS; - ConLog.Error("Function '%s' hooked twice", g_static_funcs_list[j]->name); + ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name); } } // clear data - for (u32 j = 0; j < g_static_funcs_list.size(); j++) + for (u32 j = 0; j < m_static_funcs_list.size(); j++) { - if (g_static_funcs_list[j]->group == group) g_static_funcs_list[j]->found = 0; + if (m_static_funcs_list[j]->group == group) m_static_funcs_list[j]->found = 0; } char name[9] = "????????"; @@ -183,11 +182,11 @@ void StaticAnalyse(void* ptr, u32 size, u32 base) } } -void StaticExecute(u32 code) +void StaticFuncManager::StaticExecute(u32 code) { - if (code < g_static_funcs_list.size()) + if (code < m_static_funcs_list.size()) { - (*g_static_funcs_list[code]->func)(); + (*m_static_funcs_list[code]->func)(); } else { @@ -195,7 +194,26 @@ void StaticExecute(u32 code) } } -void StaticFinalize() +void StaticFuncManager::StaticFinalize() { - g_static_funcs_list.clear(); + m_static_funcs_list.clear(); } + +void StaticFuncManager::push_back(SFunc *ele) +{ + m_static_funcs_list.push_back(ele); +} + +SFunc *StaticFuncManager::operator[](size_t i) +{ + return m_static_funcs_list[i]; +} + +StaticFuncManager::~StaticFuncManager() +{ + for (SFunc *s : m_static_funcs_list) + { + delete s; + } +} + diff --git a/rpcs3/Emu/SysCalls/Static.h b/rpcs3/Emu/SysCalls/Static.h new file mode 100644 index 0000000000..9050ed8b80 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Static.h @@ -0,0 +1,15 @@ +#pragma once + +class SFunc; + +class StaticFuncManager +{ + std::vector m_static_funcs_list; +public: + void StaticAnalyse(void* ptr, u32 size, u32 base); + void StaticExecute(u32 code); + void StaticFinalize(); + void push_back(SFunc *ele); + SFunc *operator[](size_t i); + ~StaticFuncManager(); +}; diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 6018e36d1a..7ee82b5eb5 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -5,6 +5,7 @@ #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" +#include "ModuleManager.h" namespace detail{ template<> bool CheckId(u32 id, ID*& _id,const std::string &name) @@ -576,7 +577,7 @@ void SysCalls::DoSyscall(u32 code) return; } - if(CallFunc(code)) + if(Emu.GetModuleManager().CallFunc(code)) { return; } diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 57ed2e7f0d..57dc717219 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -12,6 +12,7 @@ #include "lv2/SC_Condition.h" #include "lv2/SC_Spinlock.h" #include "Emu/event.h" +#include "Static.h" //#define SYSCALLS_DEBUG #define declCPU PPUThread& CPU = GetCurrentPPUThread @@ -413,7 +414,7 @@ extern int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3); extern int sys_rsx_device_unmap(); extern int sys_rsx_attribute(); -#define UNIMPLEMENTED_FUNC(module) module.Error("Unimplemented function: %s", __FUNCTION__) +#define UNIMPLEMENTED_FUNC(module) module->Error("Unimplemented function: %s", __FUNCTION__) #define SC_ARG_0 CPU.GPR[3] #define SC_ARG_1 CPU.GPR[4] @@ -456,16 +457,12 @@ public: //extern SysCalls SysCallsManager; -void StaticAnalyse(void* ptr, u32 size, u32 base); -void StaticExecute(u32 code); -void StaticFinalize(); - #define REG_SUB(module, group, name, ...) \ static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \ - module.AddFuncSub(group, name ## _table, #name, name) + module->AddFuncSub(group, name ## _table, #name, name) #define REG_SUB_EMPTY(module, group, name,...) \ static const u64 name ## _table[] = {0}; \ - module.AddFuncSub(group, name ## _table, #name, name) + module->AddFuncSub(group, name ## _table, #name, name) extern u64 get_system_time(); \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp index 921f135fb4..841b9651cf 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp @@ -11,7 +11,7 @@ #include "SC_FileSystem.h" #include "Emu/SysCalls/SysCalls.h" -extern Module sys_fs; +extern Module *sys_fs; enum { @@ -55,7 +55,7 @@ struct FsRingBufferConfig int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) { const std::string& path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)", + sys_fs->Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)", path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size); const std::string& ppath = path; @@ -112,7 +112,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) if(_oflags != 0) { - sys_fs.Error("\"%s\" has unknown flags! flags: 0x%08x", ppath.c_str(), flags); + sys_fs->Error("\"%s\" has unknown flags! flags: 0x%08x", ppath.c_str(), flags); return CELL_EINVAL; } @@ -121,11 +121,11 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) if(!stream || !stream->IsOpened()) { delete stream; - sys_fs.Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags); + sys_fs->Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags); return CELL_ENOENT; } - fd = sys_fs.GetNewId(stream, IDFlag_File); + fd = sys_fs->GetNewId(stream, IDFlag_File); ConLog.Warning("*** cellFsOpen(path=\"%s\"): fd = %d", path.c_str(), fd.GetValue()); return CELL_OK; @@ -133,10 +133,10 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) int cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread) { - sys_fs.Log("cellFsRead(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nread_addr=0x%x)", + sys_fs->Log("cellFsRead(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nread_addr=0x%x)", fd, buf_addr, nbytes, nread.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (nread.GetAddr() && !nread.IsGood()) return CELL_EFAULT; @@ -181,10 +181,10 @@ fin: int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite) { - sys_fs.Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)", + sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)", fd, buf_addr, nbytes, nwrite.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if(Memory.IsGoodAddr(buf_addr) && !Memory.IsGoodAddr(buf_addr, nbytes)) { @@ -202,7 +202,7 @@ int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite) int cellFsClose(u32 fd) { - sys_fs.Warning("cellFsClose(fd=%d)", fd); + sys_fs->Warning("cellFsClose(fd=%d)", fd); if(!Emu.GetIdManager().RemoveID(fd)) return CELL_ESRCH; @@ -213,7 +213,7 @@ int cellFsClose(u32 fd) int cellFsOpendir(u32 path_addr, mem32_t fd) { const std::string& path = Memory.ReadString(path_addr); - sys_fs.Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.c_str(), fd.GetAddr()); + sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.c_str(), fd.GetAddr()); if(!Memory.IsGoodAddr(path_addr) || !fd.IsGood()) return CELL_EFAULT; @@ -225,16 +225,16 @@ int cellFsOpendir(u32 path_addr, mem32_t fd) return CELL_ENOENT; } - fd = sys_fs.GetNewId(dir, IDFlag_Dir); + fd = sys_fs->GetNewId(dir, IDFlag_Dir); return CELL_OK; } int cellFsReaddir(u32 fd, mem_ptr_t dir, mem64_t nread) { - sys_fs.Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.GetAddr()); + sys_fs->Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.GetAddr()); vfsDirBase* directory; - if(!sys_fs.CheckId(fd, directory)) + if(!sys_fs->CheckId(fd, directory)) return CELL_ESRCH; if(!dir.IsGood() || !nread.IsGood()) return CELL_EFAULT; @@ -257,7 +257,7 @@ int cellFsReaddir(u32 fd, mem_ptr_t dir, mem64_t nread) int cellFsClosedir(u32 fd) { - sys_fs.Log("cellFsClosedir(fd=%d)", fd); + sys_fs->Log("cellFsClosedir(fd=%d)", fd); if(!Emu.GetIdManager().RemoveID(fd)) return CELL_ESRCH; @@ -268,7 +268,7 @@ int cellFsClosedir(u32 fd) int cellFsStat(const u32 path_addr, mem_ptr_t sb) { const std::string& path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr()); + sys_fs->Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr()); sb->st_mode = CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | @@ -301,17 +301,17 @@ int cellFsStat(const u32 path_addr, mem_ptr_t sb) } } - sys_fs.Warning("cellFsStat: \"%s\" not found.", path.c_str()); + sys_fs->Warning("cellFsStat: \"%s\" not found.", path.c_str()); return CELL_ENOENT; } int cellFsFstat(u32 fd, mem_ptr_t sb) { - sys_fs.Log("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.GetAddr()); + sys_fs->Log("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.GetAddr()); u32 attr; vfsStream* file; - if(!sys_fs.CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; sb->st_mode = CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | @@ -333,7 +333,7 @@ int cellFsFstat(u32 fd, mem_ptr_t sb) int cellFsMkdir(u32 path_addr, u32 mode) { const std::string& ps3_path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsMkdir(path=\"%s\", mode=0x%x)", ps3_path.c_str(), mode); + sys_fs->Log("cellFsMkdir(path=\"%s\", mode=0x%x)", ps3_path.c_str(), mode); /*vfsDir dir; if(dir.IsExists(ps3_path)) @@ -382,7 +382,7 @@ int cellFsRename(u32 from_addr, u32 to_addr) int cellFsRmdir(u32 path_addr) { const std::string& ps3_path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsRmdir(path=\"%s\")", ps3_path.c_str()); + sys_fs->Log("cellFsRmdir(path=\"%s\")", ps3_path.c_str()); vfsDir d; if(!d.IsExists(ps3_path)) @@ -397,7 +397,7 @@ int cellFsRmdir(u32 path_addr) int cellFsUnlink(u32 path_addr) { const std::string& ps3_path = Memory.ReadString(path_addr); - sys_fs.Warning("cellFsUnlink(path=\"%s\")", ps3_path.c_str()); + sys_fs->Warning("cellFsUnlink(path=\"%s\")", ps3_path.c_str()); if (ps3_path.empty()) return CELL_EFAULT; @@ -417,30 +417,30 @@ int cellFsUnlink(u32 path_addr) int cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos) { vfsSeekMode seek_mode; - sys_fs.Log("cellFsLseek(fd=%d, offset=0x%llx, whence=0x%x, pos_addr=0x%x)", fd, offset, whence, pos.GetAddr()); + sys_fs->Log("cellFsLseek(fd=%d, offset=0x%llx, whence=0x%x, pos_addr=0x%x)", fd, offset, whence, pos.GetAddr()); switch(whence) { case CELL_SEEK_SET: seek_mode = vfsSeekSet; break; case CELL_SEEK_CUR: seek_mode = vfsSeekCur; break; case CELL_SEEK_END: seek_mode = vfsSeekEnd; break; default: - sys_fs.Error(fd, "Unknown seek whence! (0x%x)", whence); + sys_fs->Error(fd, "Unknown seek whence! (0x%x)", whence); return CELL_EINVAL; } u32 attr; vfsStream* file; - if(!sys_fs.CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; pos = file->Seek(offset, seek_mode); return CELL_OK; } int cellFsFtruncate(u32 fd, u64 size) { - sys_fs.Log("cellFsFtruncate(fd=%d, size=%lld)", fd, size); + sys_fs->Log("cellFsFtruncate(fd=%d, size=%lld)", fd, size); u32 attr; vfsStream* file; - if(!sys_fs.CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file, attr) || attr != IDFlag_File) return CELL_ESRCH; u64 initialSize = file->GetSize(); if (initialSize < size) @@ -464,12 +464,12 @@ int cellFsFtruncate(u32 fd, u64 size) int cellFsTruncate(u32 path_addr, u64 size) { const std::string& path = Memory.ReadString(path_addr); - sys_fs.Log("cellFsTruncate(path=\"%s\", size=%lld)", path.c_str(), size); + sys_fs->Log("cellFsTruncate(path=\"%s\", size=%lld)", path.c_str(), size); vfsFile f(path, vfsReadWrite); if(!f.IsOpened()) { - sys_fs.Warning("cellFsTruncate: \"%s\" not found.", path.c_str()); + sys_fs->Warning("cellFsTruncate: \"%s\" not found.", path.c_str()); return CELL_ENOENT; } u64 initialSize = f.GetSize(); @@ -494,10 +494,10 @@ int cellFsTruncate(u32 path_addr, u64 size) int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size) { - sys_fs.Log("cellFsFGetBlockSize(fd=%d, sector_size_addr: 0x%x, block_size_addr: 0x%x)", fd, sector_size.GetAddr(), block_size.GetAddr()); + sys_fs->Log("cellFsFGetBlockSize(fd=%d, sector_size_addr: 0x%x, block_size_addr: 0x%x)", fd, sector_size.GetAddr(), block_size.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; sector_size = 4096; // ? block_size = 4096; // ? @@ -507,7 +507,7 @@ int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size) int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size) { - sys_fs.Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).c_str(), sector_size.GetAddr(), block_size.GetAddr()); + sys_fs->Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).c_str(), sector_size.GetAddr(), block_size.GetAddr()); sector_size = 4096; // ? block_size = 4096; // ? @@ -518,7 +518,7 @@ int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size) int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count) { const std::string& ps3_path = Memory.ReadString(path_addr); - sys_fs.Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)", + sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)", ps3_path.c_str(), block_size.GetAddr(), block_count.GetAddr()); if (!Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood()) @@ -536,10 +536,10 @@ int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count) int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t entries, u32 entries_size, mem32_t data_count) { - sys_fs.Log("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size = 0x%x, data_count_addr=0x%x)", fd, entries.GetAddr(), entries_size, data_count.GetAddr()); + sys_fs->Log("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size = 0x%x, data_count_addr=0x%x)", fd, entries.GetAddr(), entries_size, data_count.GetAddr()); vfsDirBase* directory; - if(!sys_fs.CheckId(fd, directory)) + if(!sys_fs->CheckId(fd, directory)) return CELL_ESRCH; if(!entries.IsGood() || !data_count.IsGood()) return CELL_EFAULT; @@ -574,10 +574,10 @@ int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t entries, u int cellFsStReadInit(u32 fd, mem_ptr_t ringbuf) { - sys_fs.Warning("cellFsStReadInit(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr()); + sys_fs->Warning("cellFsStReadInit(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if(!ringbuf.IsGood()) return CELL_EFAULT; @@ -604,10 +604,10 @@ int cellFsStReadInit(u32 fd, mem_ptr_t ringbuf) int cellFsStReadFinish(u32 fd) { - sys_fs.Warning("cellFsStReadFinish(fd=%d)", fd); + sys_fs->Warning("cellFsStReadFinish(fd=%d)", fd); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; Memory.Free(m_fs_config.m_buffer); m_fs_config.m_fs_status = CELL_FS_ST_NOT_INITIALIZED; @@ -617,10 +617,10 @@ int cellFsStReadFinish(u32 fd) int cellFsStReadGetRingBuf(u32 fd, mem_ptr_t ringbuf) { - sys_fs.Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr()); + sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if(!ringbuf.IsGood()) return CELL_EFAULT; @@ -632,17 +632,17 @@ int cellFsStReadGetRingBuf(u32 fd, mem_ptr_t ringbuf) ringbuf->ringbuf_size = buffer.m_ringbuf_size; ringbuf->transfer_rate = buffer.m_transfer_rate; - sys_fs.Warning("*** fs stream config: block_size=0x%llx, copy=%d, ringbuf_size = 0x%llx, transfer_rate = 0x%llx", ringbuf->block_size, ringbuf->copy, + sys_fs->Warning("*** fs stream config: block_size=0x%llx, copy=%d, ringbuf_size = 0x%llx, transfer_rate = 0x%llx", ringbuf->block_size, ringbuf->copy, ringbuf->ringbuf_size, ringbuf->transfer_rate); return CELL_OK; } int cellFsStReadGetStatus(u32 fd, mem64_t status) { - sys_fs.Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.GetAddr()); + sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; status = m_fs_config.m_fs_status; @@ -651,10 +651,10 @@ int cellFsStReadGetStatus(u32 fd, mem64_t status) int cellFsStReadGetRegid(u32 fd, mem64_t regid) { - sys_fs.Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.GetAddr()); + sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; regid = m_fs_config.m_regid; @@ -663,10 +663,10 @@ int cellFsStReadGetRegid(u32 fd, mem64_t regid) int cellFsStReadStart(u32 fd, u64 offset, u64 size) { - sys_fs.Warning("TODO: cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size); + sys_fs->Warning("TODO: cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; m_fs_config.m_current_addr = m_fs_config.m_buffer + (u32)offset; m_fs_config.m_fs_status = CELL_FS_ST_PROGRESS; @@ -676,10 +676,10 @@ int cellFsStReadStart(u32 fd, u64 offset, u64 size) int cellFsStReadStop(u32 fd) { - sys_fs.Warning("cellFsStReadStop(fd=%d)", fd); + sys_fs->Warning("cellFsStReadStop(fd=%d)", fd); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; m_fs_config.m_fs_status = CELL_FS_ST_STOP; @@ -688,10 +688,10 @@ int cellFsStReadStop(u32 fd) int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize) { - sys_fs.Warning("TODO: cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr()); + sys_fs->Warning("TODO: cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (rsize.GetAddr() && !rsize.IsGood()) return CELL_EFAULT; @@ -703,10 +703,10 @@ int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize) int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size) { - sys_fs.Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr()); + sys_fs->Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr()); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!addr_addr.IsGood() && !size.IsGood()) return CELL_EFAULT; @@ -715,10 +715,10 @@ int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size) int cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size) { - sys_fs.Warning("TODO: cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size); + sys_fs->Warning("TODO: cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!Memory.IsGoodAddr(addr_addr)) return CELL_EFAULT; @@ -727,23 +727,23 @@ int cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size) int cellFsStReadWait(u32 fd, u64 size) { - sys_fs.Warning("TODO: cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size); + sys_fs->Warning("TODO: cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size); vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; return CELL_OK; } int cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t func) { - sys_fs.Warning("TODO: cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr()); + sys_fs->Warning("TODO: cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr()); if (!func.IsGood()) return CELL_EFAULT; vfsStream* file; - if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH; + if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; return CELL_OK; } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp index f0fd45d1cb..2a88871912 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp @@ -8,7 +8,7 @@ #include "Emu/Io/Keyboard.h" #include "Emu/SysCalls/SysCalls.h" -extern Module sys_io; +extern Module *sys_io; enum CELL_KB_ERROR_CODE { @@ -24,7 +24,7 @@ enum CELL_KB_ERROR_CODE int cellKbInit(u32 max_connect) { - sys_io.Log("cellKbInit(max_connect=%d)", max_connect); + sys_io->Log("cellKbInit(max_connect=%d)", max_connect); if(Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_ALREADY_INITIALIZED; if(max_connect > 7) return CELL_KB_ERROR_INVALID_PARAMETER; @@ -34,7 +34,7 @@ int cellKbInit(u32 max_connect) int cellKbEnd() { - sys_io.Log("cellKbEnd()"); + sys_io->Log("cellKbEnd()"); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; Emu.GetKeyboardManager().Close(); return CELL_OK; @@ -42,7 +42,7 @@ int cellKbEnd() int cellKbClearBuf(u32 port_no) { - sys_io.Log("cellKbClearBuf(port_no=%d)", port_no); + sys_io->Log("cellKbClearBuf(port_no=%d)", port_no); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; if(port_no >= Emu.GetKeyboardManager().GetKeyboards().size()) return CELL_KB_ERROR_INVALID_PARAMETER; @@ -53,7 +53,7 @@ int cellKbClearBuf(u32 port_no) u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) { - sys_io.Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode); + sys_io->Log("cellKbCnvRawCode(arrange=%d,mkey=%d,led=%d,rawcode=%d)", arrange, mkey, led, rawcode); // CELL_KB_RAWDAT if ((rawcode >= 0x00 && rawcode <= 0x03) || rawcode == 0x29 || rawcode == 0x35 || @@ -101,7 +101,7 @@ u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode) int cellKbGetInfo(mem_class_t info) { - sys_io.Log("cellKbGetInfo(info_addr=0x%x)", info.GetAddr()); + sys_io->Log("cellKbGetInfo(info_addr=0x%x)", info.GetAddr()); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; const KbInfo& current_info = Emu.GetKeyboardManager().GetInfo(); @@ -118,7 +118,7 @@ int cellKbGetInfo(mem_class_t info) int cellKbRead(u32 port_no, mem_class_t data) { - sys_io.Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.GetAddr()); + sys_io->Log("cellKbRead(port_no=%d,info_addr=0x%x)", port_no, data.GetAddr()); const std::vector& keyboards = Emu.GetKeyboardManager().GetKeyboards(); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; @@ -140,7 +140,7 @@ int cellKbRead(u32 port_no, mem_class_t data) int cellKbSetCodeType(u32 port_no, u32 type) { - sys_io.Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type); + sys_io->Log("cellKbSetCodeType(port_no=%d,type=%d)", port_no, type); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); @@ -156,7 +156,7 @@ int cellKbSetLEDStatus(u32 port_no, u8 led) int cellKbSetReadMode(u32 port_no, u32 rmode) { - sys_io.Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode); + sys_io->Log("cellKbSetReadMode(port_no=%d,rmode=%d)", port_no, rmode); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); @@ -167,7 +167,7 @@ int cellKbSetReadMode(u32 port_no, u32 rmode) int cellKbGetConfiguration(u32 port_no, mem_class_t config) { - sys_io.Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.GetAddr()); + sys_io->Log("cellKbGetConfiguration(port_no=%d,config_addr=0x%x)", port_no, config.GetAddr()); if(!Emu.GetKeyboardManager().IsInited()) return CELL_KB_ERROR_UNINITIALIZED; const CellKbConfig& current_config = Emu.GetKeyboardManager().GetConfig(port_no); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp index 3e8846c2d6..bf409e6748 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp @@ -8,7 +8,7 @@ #include "Emu/Io/Mouse.h" #include "Emu/SysCalls/SysCalls.h" -extern Module sys_io; +extern Module *sys_io; enum CELL_MOUSE_ERROR_CODE { @@ -24,7 +24,7 @@ enum CELL_MOUSE_ERROR_CODE int cellMouseInit(u32 max_connect) { - sys_io.Log("cellMouseInit(max_connect=%d)", max_connect); + sys_io->Log("cellMouseInit(max_connect=%d)", max_connect); if(Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_ALREADY_INITIALIZED; if(max_connect > 7) return CELL_MOUSE_ERROR_INVALID_PARAMETER; @@ -35,7 +35,7 @@ int cellMouseInit(u32 max_connect) int cellMouseClearBuf(u32 port_no) { - sys_io.Log("cellMouseClearBuf(port_no=%d)", port_no); + sys_io->Log("cellMouseClearBuf(port_no=%d)", port_no); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER; @@ -46,7 +46,7 @@ int cellMouseClearBuf(u32 port_no) int cellMouseEnd() { - sys_io.Log("cellMouseEnd()"); + sys_io->Log("cellMouseEnd()"); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; Emu.GetMouseManager().Close(); return CELL_OK; @@ -54,7 +54,7 @@ int cellMouseEnd() int cellMouseGetInfo(mem_class_t info) { - sys_io.Log("cellMouseGetInfo(info_addr=0x%x)", info.GetAddr()); + sys_io->Log("cellMouseGetInfo(info_addr=0x%x)", info.GetAddr()); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; const MouseInfo& current_info = Emu.GetMouseManager().GetInfo(); @@ -70,7 +70,7 @@ int cellMouseGetInfo(mem_class_t info) int cellMouseInfoTabletMode(u32 port_no, mem_class_t info) { - sys_io.Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.GetAddr()); + sys_io->Log("cellMouseInfoTabletMode(port_no=%d,info_addr=0x%x)", port_no, info.GetAddr()); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_INVALID_PARAMETER; @@ -82,7 +82,7 @@ int cellMouseInfoTabletMode(u32 port_no, mem_class_t info) int cellMouseGetData(u32 port_no, mem_class_t data) { - sys_io.Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr()); + sys_io->Log("cellMouseGetData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr()); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE; @@ -127,7 +127,7 @@ int cellMouseGetRawData(u32 port_no, mem_class_t data) { UNIMPLEMENTED_FUNC(sys_io); - /*sys_io.Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr()); + /*sys_io->Log("cellMouseGetRawData(port_no=%d,data_addr=0x%x)", port_no, data.GetAddr()); if(!Emu.GetMouseManager().IsInited()) return CELL_MOUSE_ERROR_UNINITIALIZED; if(port_no >= Emu.GetMouseManager().GetMice().size()) return CELL_MOUSE_ERROR_NO_DEVICE; diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 1c8a82e4c6..c383dae656 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -7,7 +7,7 @@ #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" -extern Module sysPrxForUser; +extern Module *sysPrxForUser; static const u32 PPU_THREAD_ID_INVALID = 0xFFFFFFFFU; enum @@ -18,7 +18,7 @@ enum void sys_ppu_thread_exit(u64 errorcode) { - sysPrxForUser.Log("sys_ppu_thread_exit(0x%llx)", errorcode); + sysPrxForUser->Log("sys_ppu_thread_exit(0x%llx)", errorcode); PPUThread& thr = GetCurrentPPUThread(); u32 tid = thr.GetId(); @@ -35,14 +35,14 @@ void sys_ppu_thread_exit(u64 errorcode) int sys_ppu_thread_yield() { - sysPrxForUser.Log("sys_ppu_thread_yield()"); + sysPrxForUser->Log("sys_ppu_thread_yield()"); Sleep(1); return CELL_OK; } int sys_ppu_thread_join(u32 thread_id, mem64_t vptr) { - sysPrxForUser.Warning("sys_ppu_thread_join(thread_id=%d, vptr_addr=0x%x)", thread_id, vptr.GetAddr()); + sysPrxForUser->Warning("sys_ppu_thread_join(thread_id=%d, vptr_addr=0x%x)", thread_id, vptr.GetAddr()); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -63,7 +63,7 @@ int sys_ppu_thread_join(u32 thread_id, mem64_t vptr) int sys_ppu_thread_detach(u32 thread_id) { - sysPrxForUser.Error("sys_ppu_thread_detach(thread_id=%d)", thread_id); + sysPrxForUser->Error("sys_ppu_thread_detach(thread_id=%d)", thread_id); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -77,13 +77,13 @@ int sys_ppu_thread_detach(u32 thread_id) void sys_ppu_thread_get_join_state(u32 isjoinable_addr) { - sysPrxForUser.Warning("sys_ppu_thread_get_join_state(isjoinable_addr=0x%x)", isjoinable_addr); + sysPrxForUser->Warning("sys_ppu_thread_get_join_state(isjoinable_addr=0x%x)", isjoinable_addr); Memory.Write32(isjoinable_addr, GetCurrentPPUThread().IsJoinable()); } int sys_ppu_thread_set_priority(u32 thread_id, int prio) { - sysPrxForUser.Warning("sys_ppu_thread_set_priority(thread_id=%d, prio=%d)", thread_id, prio); + sysPrxForUser->Warning("sys_ppu_thread_set_priority(thread_id=%d, prio=%d)", thread_id, prio); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -95,7 +95,7 @@ int sys_ppu_thread_set_priority(u32 thread_id, int prio) int sys_ppu_thread_get_priority(u32 thread_id, u32 prio_addr) { - sysPrxForUser.Log("sys_ppu_thread_get_priority(thread_id=%d, prio_addr=0x%x)", thread_id, prio_addr); + sysPrxForUser->Log("sys_ppu_thread_get_priority(thread_id=%d, prio_addr=0x%x)", thread_id, prio_addr); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -108,7 +108,7 @@ int sys_ppu_thread_get_priority(u32 thread_id, u32 prio_addr) int sys_ppu_thread_get_stack_information(u32 info_addr) { - sysPrxForUser.Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr); + sysPrxForUser->Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr); if(!Memory.IsGoodAddr(info_addr)) return CELL_EFAULT; @@ -122,7 +122,7 @@ int sys_ppu_thread_get_stack_information(u32 info_addr) int sys_ppu_thread_stop(u32 thread_id) { - sysPrxForUser.Warning("sys_ppu_thread_stop(thread_id=%d)", thread_id); + sysPrxForUser->Warning("sys_ppu_thread_stop(thread_id=%d)", thread_id); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -134,7 +134,7 @@ int sys_ppu_thread_stop(u32 thread_id) int sys_ppu_thread_restart(u32 thread_id) { - sysPrxForUser.Warning("sys_ppu_thread_restart(thread_id=%d)", thread_id); + sysPrxForUser->Warning("sys_ppu_thread_restart(thread_id=%d)", thread_id); CPUThread* thr = Emu.GetCPU().GetThread(thread_id); if(!thr) return CELL_ESRCH; @@ -147,7 +147,7 @@ int sys_ppu_thread_restart(u32 thread_id) int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr) { - sysPrxForUser.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", + sysPrxForUser->Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%x, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))", thread_id_addr, entry, arg, prio, stacksize, flags, threadname_addr, Memory.ReadString(threadname_addr).c_str()); if(!Memory.IsGoodAddr(entry) || !Memory.IsGoodAddr(thread_id_addr) || !Memory.IsGoodAddr(threadname_addr)) @@ -175,7 +175,7 @@ int sys_ppu_thread_create(u32 thread_id_addr, u32 entry, u64 arg, int prio, u32 void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry) { - sysPrxForUser.Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, entry=0x%x)", once_ctrl_addr, entry); + sysPrxForUser->Warning("sys_ppu_thread_once(once_ctrl_addr=0x%x, entry=0x%x)", once_ctrl_addr, entry); if(Memory.IsGoodAddr(once_ctrl_addr, 4) && Memory.Read32(once_ctrl_addr) == SYS_PPU_THREAD_ONCE_INIT) { @@ -192,7 +192,7 @@ void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry) int sys_ppu_thread_get_id(const u32 id_addr) { - sysPrxForUser.Log("sys_ppu_thread_get_id(id_addr=0x%x)", id_addr); + sysPrxForUser->Log("sys_ppu_thread_get_id(id_addr=0x%x)", id_addr); Memory.Write64(id_addr, GetCurrentPPUThread().GetId()); return CELL_OK; diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp index dead7e5e58..79467d519e 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp @@ -8,7 +8,7 @@ #include "Emu/Io/Pad.h" #include "Emu/SysCalls/SysCalls.h" -extern Module sys_io; +extern Module *sys_io; enum CELL_PAD_ERROR_CODE { @@ -58,7 +58,7 @@ struct CellCapabilityInfo int cellPadInit(u32 max_connect) { - sys_io.Log("cellPadInit(max_connect=%d)", max_connect); + sys_io->Log("cellPadInit(max_connect=%d)", max_connect); if(Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_ALREADY_INITIALIZED; if (max_connect > CELL_PAD_MAX_PORT_NUM) return CELL_PAD_ERROR_INVALID_PARAMETER; Emu.GetPadManager().Init(max_connect); @@ -67,7 +67,7 @@ int cellPadInit(u32 max_connect) int cellPadEnd() { - sys_io.Log("cellPadEnd()"); + sys_io->Log("cellPadEnd()"); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; Emu.GetPadManager().Close(); return CELL_OK; @@ -75,7 +75,7 @@ int cellPadEnd() int cellPadClearBuf(u32 port_no) { - sys_io.Log("cellPadClearBuf(port_no=%d)", port_no); + sys_io->Log("cellPadClearBuf(port_no=%d)", port_no); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -104,7 +104,7 @@ int cellPadClearBuf(u32 port_no) int cellPadGetData(u32 port_no, u32 data_addr) { - sys_io.Log("cellPadGetData[port_no: %d, data_addr: 0x%x]", port_no, data_addr); + sys_io->Log("cellPadGetData[port_no: %d, data_addr: 0x%x]", port_no, data_addr); std::vector& pads = Emu.GetPadManager().GetPads(); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); @@ -279,7 +279,7 @@ int cellPadGetData(u32 port_no, u32 data_addr) int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr) { - sys_io.Log("cellPadGetDataExtra(port_no=%d, device_type_addr=0x%x, device_type_addr=0x%x)", port_no, device_type_addr, data_addr); + sys_io->Log("cellPadGetDataExtra(port_no=%d, device_type_addr=0x%x, device_type_addr=0x%x)", port_no, device_type_addr, data_addr); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -290,7 +290,7 @@ int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr) int cellPadSetActDirect(u32 port_no, u32 param_addr) { - sys_io.Log("cellPadSetActDirect(port_no=%d, param_addr=0x%x)", port_no, param_addr); + sys_io->Log("cellPadSetActDirect(port_no=%d, param_addr=0x%x)", port_no, param_addr); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -301,7 +301,7 @@ int cellPadSetActDirect(u32 port_no, u32 param_addr) 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; CellPadInfo info; @@ -333,7 +333,7 @@ int cellPadGetInfo(u32 info_addr) 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; CellPadInfo2 info; @@ -365,7 +365,7 @@ int cellPadGetInfo2(u32 info_addr) int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr) { - sys_io.Log("cellPadGetCapabilityInfo[port_no: %d, data_addr: 0x%x]", port_no, info_addr.GetAddr()); + sys_io->Log("cellPadGetCapabilityInfo[port_no: %d, data_addr: 0x%x]", port_no, info_addr.GetAddr()); if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -386,7 +386,7 @@ int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr) int cellPadSetPortSetting(u32 port_no, u32 port_setting) { - sys_io.Log("cellPadSetPortSetting(port_no=%d, port_setting=0x%x)", port_no, port_setting); + sys_io->Log("cellPadSetPortSetting(port_no=%d, port_setting=0x%x)", port_no, port_setting); if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if ((port_setting < CELL_PAD_SETTING_PRESS_ON) || port_setting >(CELL_PAD_SETTING_PRESS_ON | CELL_PAD_SETTING_SENSOR_ON) && port_setting != 0) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -402,7 +402,7 @@ int cellPadSetPortSetting(u32 port_no, u32 port_setting) int cellPadInfoPressMode(u32 port_no) { - sys_io.Log("cellPadInfoPressMode(port_no=%d)", port_no); + sys_io->Log("cellPadInfoPressMode(port_no=%d)", port_no); if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -415,7 +415,7 @@ int cellPadInfoPressMode(u32 port_no) int cellPadInfoSensorMode(u32 port_no) { - sys_io.Log("cellPadInfoSensorMode(port_no=%d)", port_no); + sys_io->Log("cellPadInfoSensorMode(port_no=%d)", port_no); if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); if (port_no >= rinfo.max_connect) return CELL_PAD_ERROR_INVALID_PARAMETER; @@ -428,7 +428,7 @@ int cellPadInfoSensorMode(u32 port_no) int cellPadSetPressMode(u32 port_no, u32 mode) { - sys_io.Log("cellPadSetPressMode(port_no=%u, mode=%u)", port_no, mode); + sys_io->Log("cellPadSetPressMode(port_no=%u, mode=%u)", port_no, mode); if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); @@ -447,7 +447,7 @@ int cellPadSetPressMode(u32 port_no, u32 mode) int cellPadSetSensorMode(u32 port_no, u32 mode) { - sys_io.Log("cellPadSetSensorMode(port_no=%u, mode=%u)", port_no, mode); + sys_io->Log("cellPadSetSensorMode(port_no=%u, mode=%u)", port_no, mode); if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp index c92e38a0d8..174dfd839a 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp @@ -18,7 +18,7 @@ struct semaphore_attr struct semaphore { - wxSemaphore sem; + rSemaphore sem; semaphore_attr attr; int sem_count; diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp index 5e58c41d5e..9d2e410fa3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp @@ -100,7 +100,7 @@ int sys_timer_disconnect_event_queue(u32 timer_id) int sys_timer_sleep(u32 sleep_time) { sys_timer.Warning("sys_timer_sleep(sleep_time=%d)", sleep_time); - wxSleep(sleep_time); + rSleep(sleep_time); return CELL_OK; } @@ -108,6 +108,6 @@ int sys_timer_usleep(u64 sleep_time) { sys_timer.Log("sys_timer_usleep(sleep_time=%lld)", sleep_time); if (sleep_time > 0xFFFFFFFFFFFF) sleep_time = 0xFFFFFFFFFFFF; //2^48-1 - wxMicroSleep(sleep_time); //TODO: If (sleep_time >= 2^32) shit may happen + rMicroSleep(sleep_time); //TODO: If (sleep_time >= 2^32) shit may happen return CELL_OK; } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Timer.h b/rpcs3/Emu/SysCalls/lv2/SC_Timer.h index 182008733b..f8749970fe 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Timer.h +++ b/rpcs3/Emu/SysCalls/lv2/SC_Timer.h @@ -16,7 +16,7 @@ struct sys_timer_information_t struct timer { - wxTimer tmr; + rTimer tmr; sys_timer_information_t timer_information_t; }; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index a6bbe584ae..f07840c167 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -4,11 +4,16 @@ #include "Emu/System.h" #include "Ini.h" +#include "Emu/GameInfo.h" +#include "Emu/SysCalls/Static.h" +#include "Emu/SysCalls/ModuleManager.h" #include "Emu/Cell/PPUThread.h" #include "Emu/Cell/SPUThread.h" #include "Emu/Cell/PPUInstrTable.h" #include "Emu/FS/vfsFile.h" +#include "Emu/CPU/CPUThreadManager.h" //gui dependency + #include "../Crypto/unself.h" #include #include @@ -29,6 +34,9 @@ Emulator::Emulator() , m_rsx_callback(0) , m_ppu_callback_thr(0) , m_event_manager(new EventManager()) + , m_sfunc_manager(new StaticFuncManager()) + , m_module_manager(new ModuleManager()) + , m_thread_manager(new CPUThreadManager()) { } @@ -107,7 +115,7 @@ bool Emulator::BootGame(const std::string& path) { const std::string& curpath = path + elf_path[i]; - if(wxFile::Access(fmt::FromUTF8(curpath), wxFile::read)) + if(rFile::Access(curpath, rFile::read)) { SetPath(curpath); Load(); @@ -121,20 +129,22 @@ bool Emulator::BootGame(const std::string& path) void Emulator::Load() { - if(!wxFileExists(fmt::FromUTF8(m_path))) return; + GetModuleManager().init(); + + if(!rFileExists(m_path)) return; if(IsSelf(m_path)) { std::string self_path = m_path; - std::string elf_path = fmt::ToUTF8(wxFileName(fmt::FromUTF8(m_path)).GetPath()); + std::string elf_path = rFileName(m_path).GetPath(); - if (wxFileName(fmt::FromUTF8(m_path)).GetFullName().CmpNoCase("EBOOT.BIN") == 0) + if (fmt::CmpNoCase(rFileName(m_path).GetFullName(),"EBOOT.BIN") == 0) { elf_path += "/BOOT.BIN"; } else { - elf_path += "/" + fmt::ToUTF8(wxFileName(fmt::FromUTF8(m_path)).GetName()) + ".elf"; + elf_path += "/" + rFileName(m_path).GetName() + ".elf"; } if(!DecryptSelf(elf_path, self_path)) @@ -297,9 +307,7 @@ void Emulator::Load() thread.Run(); m_status = Ready; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_READY_EMU); -#endif + SendDbgCommand(DID_READY_EMU); } void Emulator::Run() @@ -316,9 +324,7 @@ void Emulator::Run() Resume(); return; } -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_START_EMU); -#endif + SendDbgCommand(DID_START_EMU); //ConLog.Write("run..."); m_status = Running; @@ -330,40 +336,30 @@ void Emulator::Run() //m_memory_viewer->ShowPC(); GetCPU().Exec(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STARTED_EMU); -#endif + SendDbgCommand(DID_STARTED_EMU); } void Emulator::Pause() { if(!IsRunning()) return; //ConLog.Write("pause..."); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_PAUSE_EMU); -#endif + SendDbgCommand(DID_PAUSE_EMU); m_status = Paused; -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_PAUSED_EMU); -#endif + SendDbgCommand(DID_PAUSED_EMU); } void Emulator::Resume() { if(!IsPaused()) return; //ConLog.Write("resume..."); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_RESUME_EMU); -#endif + SendDbgCommand(DID_RESUME_EMU); m_status = Running; CheckStatus(); //if(IsRunning() && Ini.CPUDecoderMode.GetValue() != 1) GetCPU().Exec(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_RESUMED_EMU); -#endif + SendDbgCommand(DID_RESUMED_EMU); } void Emulator::Stop() @@ -371,9 +367,7 @@ void Emulator::Stop() if(IsStopped()) return; //ConLog.Write("shutdown..."); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STOP_EMU); -#endif + SendDbgCommand(DID_STOP_EMU); m_status = Stopped; m_rsx_callback = 0; @@ -394,15 +388,14 @@ void Emulator::Stop() GetKeyboardManager().Close(); GetMouseManager().Close(); GetCallbackManager().Clear(); - UnloadModules(); + //not all modules unload cleanly, so we're not unloading them for now + //GetModuleManager().UnloadModules(); CurGameInfo.Reset(); Memory.Close(); //if(m_memory_viewer && m_memory_viewer->IsShown()) m_memory_viewer->Hide(); -#ifndef QT_UI - wxGetApp().SendDbgCommand(DID_STOPPED_EMU); -#endif + SendDbgCommand(DID_STOPPED_EMU); } void Emulator::SavePoints(const std::string& path) diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index 63755b65f3..c967e66de8 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -1,20 +1,21 @@ #pragma once #include -#include "Gui/MemoryViewer.h" -#include "Emu/CPU/CPUThreadManager.h" +#include "Emu/CPU/CPUThreadManager.h" //gui dependency #include "Emu/Io/Pad.h" #include "Emu/Io/Keyboard.h" #include "Emu/Io/Mouse.h" #include "Emu/GS/GSManager.h" #include "Emu/Audio/AudioManager.h" #include "Emu/FS/VFS.h" -#include "Emu/DbgConsole.h" #include "Loader/Loader.h" #include "SysCalls/Callback.h" class EventManager; -extern void UnloadModules(); +class ModuleManager; +class StaticFuncManager; +//class CPUThreadManager; +//class CPUThread; struct EmuInfo { @@ -74,14 +75,14 @@ class Emulator u32 m_rsx_callback; u32 m_ppu_thr_exit; - MemoryViewerPanel* m_memory_viewer; + //MemoryViewerPanel* m_memory_viewer; //GUI dependency //ArrayF m_cpu_threads; std::vector> m_modules_init; std::vector m_break_points; std::vector m_marked_points; - CPUThreadManager m_thread_manager; + CPUThreadManager *m_thread_manager; PadManager m_pad_manager; KeyboardManager m_keyboard_manager; MouseManager m_mouse_manager; @@ -92,6 +93,8 @@ class Emulator CallbackManager m_callback_manager; CPUThread* m_ppu_callback_thr; std::unique_ptr m_event_manager; + std::unique_ptr m_sfunc_manager; + std::unique_ptr m_module_manager; VFS m_vfs; @@ -108,7 +111,7 @@ public: void SetPath(const std::string& path, const std::string& elf_path = ""); void SetTitleID(const std::string& id); - CPUThreadManager& GetCPU() { return m_thread_manager; } + CPUThreadManager& GetCPU() { return *m_thread_manager; } PadManager& GetPadManager() { return m_pad_manager; } KeyboardManager& GetKeyboardManager() { return m_keyboard_manager; } MouseManager& GetMouseManager() { return m_mouse_manager; } @@ -122,7 +125,9 @@ public: std::vector& GetMarkedPoints() { return m_marked_points; } CPUThread& GetCallbackThread() { return *m_ppu_callback_thr; } EventManager& GetEventManager() { return *m_event_manager; } - + StaticFuncManager& GetSFuncManager() { return *m_sfunc_manager; } + ModuleManager& GetModuleManager() { return *m_module_manager; } + void AddModuleInit(std::unique_ptr m) { m_modules_init.push_back(std::move(m)); diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index d25f16e256..870d3b7204 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -16,163 +16,8 @@ #include "Emu/System.h" -LogWriter ConLog; LogFrame* ConLogFrame; -std::mutex g_cs_conlog; - -static const uint max_item_count = 500; -static const uint buffer_size = 1024 * 64; - -static const std::string g_log_colors[] = -{ - "Black", "Green", "White", "Yellow", "Red", -}; - -struct LogPacket -{ - const std::string m_prefix; - const std::string m_text; - const std::string m_colour; - - LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) - : m_prefix(prefix) - , m_text(text) - , m_colour(colour) - { - - } -}; - -struct _LogBuffer : public MTPacketBuffer -{ - _LogBuffer() : MTPacketBuffer(buffer_size) - { - } - - void _push(const LogPacket& data) - { - const u32 sprefix = data.m_prefix.length(); - const u32 stext = data.m_text.length(); - const u32 scolour = data.m_colour.length(); - - m_buffer.resize( m_buffer.size() + - sizeof(u32) + sprefix + - sizeof(u32) + stext + - sizeof(u32) + scolour); - - u32 c_put = m_put; - - memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); - c_put += sprefix; - - memcpy(&m_buffer[c_put], &stext, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); - c_put += stext; - - memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); - c_put += scolour; - - m_put = c_put; - CheckBusy(); - } - - LogPacket _pop() - { - u32 c_get = m_get; - - const u32& sprefix = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string prefix( (const char*) &m_buffer[c_get], sprefix); - c_get += sprefix; - - const u32& stext = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string text( (const char*) &m_buffer[c_get], stext); - c_get += stext; - - const u32& scolour = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string colour( (const char*) &m_buffer[c_get], scolour); - c_get += scolour; - - m_get = c_get; - if(!HasNewPacket()) Flush(); - - return LogPacket(prefix, text, colour); - } -} LogBuffer; - -LogWriter::LogWriter() -{ - if(!m_logfile.Open(_PRGNAME_ ".log", wxFile::write)) - { -#ifndef QT_UI - wxMessageBox("Can't create log file! (" _PRGNAME_ ".log)", wxMessageBoxCaptionStr, wxICON_ERROR); -#endif - } -} - -void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/) -{ - std::string new_prefix = prefix; - if(!prefix.empty()) - { - if(NamedThreadBase* thr = GetCurrentNamedThread()) - { - new_prefix += " : " + thr->GetThreadName(); - } - } - - if(m_logfile.IsOpened() && !new_prefix.empty()) - m_logfile.Write(fmt::FromUTF8("[" + new_prefix + "]: " + value + "\n")); - - if(!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) - return; - - std::lock_guard lock(g_cs_conlog); - -#ifdef QT_UI - // TODO: Use ThreadBase instead, track main thread id - if(QThread::currentThread() == qApp->thread()) -#else - if(wxThread::IsMain()) -#endif - { - while(LogBuffer.IsBusy()) - { - // need extra break condition? - wxYieldIfNeeded(); - } - } - else - { - while (LogBuffer.IsBusy()) - { - if (Emu.IsStopped()) - { - break; - } - Sleep(1); - } - } - - //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); - - LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); -} - - -void LogWriter::SkipLn() -{ - WriteToLog("", "", 0); -} - BEGIN_EVENT_TABLE(LogFrame, wxPanel) EVT_CLOSE(LogFrame::OnQuit) END_EVENT_TABLE() diff --git a/rpcs3/Gui/DbgFrame.cpp b/rpcs3/Gui/DbgFrame.cpp new file mode 100644 index 0000000000..9f966fd932 --- /dev/null +++ b/rpcs3/Gui/DbgFrame.cpp @@ -0,0 +1,94 @@ +#include "stdafx.h" +#include "DbgFrame.h" + +BEGIN_EVENT_TABLE(DbgFrame, FrameBase) +EVT_CLOSE(DbgFrame::OnQuit) +END_EVENT_TABLE() + +DbgFrame::DbgFrame() +: FrameBase(nullptr, wxID_ANY, "DbgFrame", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) +, ThreadBase("DbgFrame thread") +, m_output(nullptr) +{ + m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, + wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); + m_console->SetBackgroundColour(wxColor("Black")); + m_console->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + + m_color_white = new wxTextAttr(wxColour(255, 255, 255)); + m_color_red = new wxTextAttr(wxColour(255, 0, 0)); + + if (Ini.HLESaveTTY.GetValue()) + m_output = new rFile("tty.log", rFile::write); +} + +DbgFrame::~DbgFrame() +{ + ThreadBase::Stop(); + m_dbg_buffer.Flush(); + + safe_delete(m_console); + safe_delete(m_color_white); + safe_delete(m_color_red); + safe_delete(m_output); +} + +void DbgFrame::Write(int ch, const std::string& text) +{ + while (m_dbg_buffer.IsBusy()) + { + if (Emu.IsStopped()) + { + return; + } + Sleep(1); + } + m_dbg_buffer.Push(DbgPacket(ch, text)); + + if (!IsAlive()) Start(); +} + +void DbgFrame::Clear() +{ + m_console->Clear(); +} + +void DbgFrame::Task() +{ + while (!TestDestroy()) + { + if (!m_dbg_buffer.HasNewPacket()) + { + if (Emu.IsStopped()) + { + break; + } + Sleep(1); + continue; + } + + DbgPacket packet = m_dbg_buffer.Pop(); + m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white); + m_console->SetInsertionPointEnd(); + m_console->WriteText(fmt::FromUTF8(packet.m_text)); + + if (m_output && Ini.HLESaveTTY.GetValue()) + m_output->Write(packet.m_text); + + if (!DbgFrame::IsShown()) Show(); + } +} + +void DbgFrame::OnQuit(wxCloseEvent& event) +{ + ThreadBase::Stop(false); + Hide(); + + if (m_output) + { + m_output->Close(); + m_output = nullptr; + } + + //event.Skip(); +} \ No newline at end of file diff --git a/rpcs3/Gui/DbgFrame.h b/rpcs3/Gui/DbgFrame.h new file mode 100644 index 0000000000..d6dda5d873 --- /dev/null +++ b/rpcs3/Gui/DbgFrame.h @@ -0,0 +1,23 @@ +#pragma once + +class DbgFrame + : public FrameBase + , public ThreadBase +{ + rFile* m_output; + wxTextCtrl* m_console; + wxTextAttr* m_color_white; + wxTextAttr* m_color_red; + _DbgBuffer m_dbg_buffer; + +public: + DbgFrame(); + ~DbgFrame(); + void Write(int ch, const std::string& text); + void Clear(); + virtual void Task(); + +private: + void OnQuit(wxCloseEvent& event); + DECLARE_EVENT_TABLE(); +}; diff --git a/rpcs3/Gui/GLGSFrame.cpp b/rpcs3/Gui/GLGSFrame.cpp new file mode 100644 index 0000000000..d5205f029e --- /dev/null +++ b/rpcs3/Gui/GLGSFrame.cpp @@ -0,0 +1,50 @@ +#include "stdafx.h" +#include "GLGSFrame.h" + +GLGSFrame::GLGSFrame() + : GSFrame(nullptr, "GSFrame[OpenGL]") + , m_frames(0) +{ + canvas = new wxGLCanvas(this, wxID_ANY, NULL); + canvas->SetSize(GetClientSize()); + + canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this); +} + +void GLGSFrame::Flip(wxGLContext *context) +{ + if (!canvas) return; + canvas->SetCurrent(*context); + + static Timer fps_t; + canvas->SwapBuffers(); + m_frames++; + + if (fps_t.GetElapsedTimeInSec() >= 0.5) + { + SetTitle(wxString::Format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec())); + m_frames = 0; + fps_t.Start(); + } +} + +void GLGSFrame::OnSize(wxSizeEvent& event) +{ + if (canvas) canvas->SetSize(GetClientSize()); + event.Skip(); +} + +void GLGSFrame::SetViewport(int x, int y, u32 w, u32 h) +{ + /* + //ConLog.Warning("SetViewport(x=%d, y=%d, w=%d, h=%d)", x, y, w, h); + + const wxSize client = GetClientSize(); + const wxSize viewport = AspectRatio(client, wxSize(w, h)); + + const int vx = (client.GetX() - viewport.GetX()) / 2; + const int vy = (client.GetY() - viewport.GetY()) / 2; + + glViewport(vx + x, vy + y, viewport.GetWidth(), viewport.GetHeight()); + */ +} \ No newline at end of file diff --git a/rpcs3/Gui/GLGSFrame.h b/rpcs3/Gui/GLGSFrame.h new file mode 100644 index 0000000000..acbc06cccc --- /dev/null +++ b/rpcs3/Gui/GLGSFrame.h @@ -0,0 +1,21 @@ +#pragma once +#include "wx/glcanvas.h" +#include "Gui/GSFrame.h" + +struct GLGSFrame : public GSFrame +{ + wxGLCanvas* canvas; + u32 m_frames; + + GLGSFrame(); + ~GLGSFrame() {} + + void Flip(wxGLContext *context); + + wxGLCanvas* GetCanvas() const { return canvas; } + + virtual void SetViewport(int x, int y, u32 w, u32 h); + +private: + virtual void OnSize(wxSizeEvent& event); +}; \ No newline at end of file diff --git a/rpcs3/Gui/GSFrame.cpp b/rpcs3/Gui/GSFrame.cpp new file mode 100644 index 0000000000..b180c0c54d --- /dev/null +++ b/rpcs3/Gui/GSFrame.cpp @@ -0,0 +1,82 @@ +#include "stdafx.h" +#include "GSFrame.h" + +BEGIN_EVENT_TABLE(GSFrame, wxFrame) + EVT_PAINT(GSFrame::OnPaint) + EVT_SIZE(GSFrame::OnSize) +END_EVENT_TABLE() + +wxSize AspectRatio(wxSize rs, const wxSize as) +{ + const double aq = (double)as.x / as.y; + const double rq = (double)rs.x / rs.y; + const double q = aq / rq; + + if (q > 1.0) + { + rs.y /= q; + } + else if (q < 1.0) + { + rs.x *= q; + } + + return rs; +} + +GSFrame::GSFrame(wxWindow* parent, const wxString& title) : wxFrame(parent, wxID_ANY, title) +{ + CellVideoOutResolution res = ResolutionTable[ResolutionIdToNum(Ini.GSResolution.GetValue())]; + SetClientSize(res.width, res.height); + wxGetApp().Bind(wxEVT_KEY_DOWN, &GSFrame::OnKeyDown, this); + Bind(wxEVT_CLOSE_WINDOW, &GSFrame::OnClose, this); +} + +void GSFrame::OnPaint(wxPaintEvent& event) +{ + wxPaintDC(this); +} + +void GSFrame::OnClose(wxCloseEvent& event) +{ + Emu.Stop(); +} + +/* +void GSFrame::OnSize(wxSizeEvent&) +{ +const wxSize client = GetClientSize(); +const wxSize viewport = AspectRatio(client, m_size); + +const int x = (client.GetX() - viewport.GetX()) / 2; +const int y = (client.GetY() - viewport.GetY()) / 2; + +SetViewport(wxPoint(x, y), viewport); +} +*/ + +void GSFrame::OnKeyDown(wxKeyEvent& event) +{ + switch (event.GetKeyCode()) + { + case WXK_RETURN: if (event.AltDown()) { OnFullScreen(); return; } break; + case WXK_ESCAPE: if (IsFullScreen()) { ShowFullScreen(false); return; } break; + } + event.Skip(); +} + +void GSFrame::OnFullScreen() +{ + ShowFullScreen(!IsFullScreen()); +} + + +/* +void GSFrame::SetSize(int width, int height) +{ +m_size.SetWidth(width); +m_size.SetHeight(height); +//wxFrame::SetSize(width, height); +OnSize(wxSizeEvent()); +} +*/ \ No newline at end of file diff --git a/rpcs3/Gui/GSFrame.h b/rpcs3/Gui/GSFrame.h new file mode 100644 index 0000000000..83601a00cf --- /dev/null +++ b/rpcs3/Gui/GSFrame.h @@ -0,0 +1,29 @@ +#pragma once + +wxSize AspectRatio(wxSize rs, const wxSize as); + +class GSFrame : public wxFrame +{ +protected: + GSFrame(wxWindow* parent, const wxString& title); + + virtual void SetViewport(int x, int y, u32 w, u32 h) {} + virtual void OnPaint(wxPaintEvent& event); + virtual void OnClose(wxCloseEvent& event); + + //virtual void OnSize(wxSizeEvent&); + + void OnKeyDown(wxKeyEvent& event); + void OnFullScreen(); + +public: + void OnLeftDclick(wxMouseEvent&) + { + OnFullScreen(); + } + + //void SetSize(int width, int height); + +private: + DECLARE_EVENT_TABLE(); +}; \ No newline at end of file diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 62a7288a95..3dcfd9c31a 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -17,6 +17,7 @@ #include "Gui/VHDDManager.h" #include "Gui/VFSManager.h" #include "Gui/AboutDialog.h" +#include "Gui/GameViewer.h" #include #include "Loader/PKG.h" @@ -261,7 +262,7 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event)) // Open and install PKG file wxString filePath = ctrl.GetPath(); - wxFile pkg_f(filePath, wxFile::read); // TODO: Use VFS to install PKG files + rFile pkg_f(filePath.ToStdString(), rFile::read); // TODO: Use VFS to install PKG files if (pkg_f.IsOpened()) { diff --git a/rpcs3/Gui/MainFrame.h b/rpcs3/Gui/MainFrame.h index 15ab70c11e..a7b0341de1 100644 --- a/rpcs3/Gui/MainFrame.h +++ b/rpcs3/Gui/MainFrame.h @@ -1,10 +1,11 @@ #pragma once #include "Gui/Debugger.h" -#include "Gui/GameViewer.h" #include +class GameViewer; + class MainFrame : public FrameBase { DebuggerPanel* m_debugger_frame; diff --git a/rpcs3/Gui/RSXDebugger.h b/rpcs3/Gui/RSXDebugger.h index bcdae7d6cb..733e552efb 100644 --- a/rpcs3/Gui/RSXDebugger.h +++ b/rpcs3/Gui/RSXDebugger.h @@ -2,22 +2,7 @@ #include -struct RSXDebuggerProgram -{ - u32 id; - u32 vp_id; - u32 fp_id; - std::string vp_shader; - std::string fp_shader; - bool modified; - RSXDebuggerProgram() - : modified(false) - { - } -}; - -extern std::vector m_debug_programs; class RSXDebugger : public wxFrame { diff --git a/rpcs3/Ini.cpp b/rpcs3/Ini.cpp index 28372b9be2..6dbfa06ec4 100644 --- a/rpcs3/Ini.cpp +++ b/rpcs3/Ini.cpp @@ -31,12 +31,12 @@ Inis Ini; static bool StringToBool(const wxString& str) { - if( + if ( !str.CmpNoCase("enable") || !str.CmpNoCase("e") || !str.CmpNoCase("1") || !str.CmpNoCase("true") || - !str.CmpNoCase("t") ) + !str.CmpNoCase("t")) { return true; } @@ -46,7 +46,7 @@ static bool StringToBool(const wxString& str) static wxString BoolToString(const bool b) { - if(b) return "true"; + if (b) return "true"; return "false"; } @@ -100,20 +100,20 @@ static wxPoint StringToPosition(const wxString& str) { wxPoint ret; - wxString s[2] = {wxEmptyString, wxEmptyString}; + wxString s[2] = { wxEmptyString, wxEmptyString }; - for(uint i=0, a=0; i= 2) return wxDefaultPosition; + if (++a >= 2) return wxDefaultPosition; continue; } s[a] += str(i, 1); } - - if(s[0].IsEmpty() || s[1].IsEmpty()) + + if (s[0].IsEmpty() || s[1].IsEmpty()) { return wxDefaultPosition; } @@ -121,7 +121,7 @@ static wxPoint StringToPosition(const wxString& str) s[0].ToLong((long*)&ret.x); s[1].ToLong((long*)&ret.y); - if(ret.x <= 0 || ret.y <= 0) + if (ret.x <= 0 || ret.y <= 0) { return wxDefaultPosition; } @@ -179,7 +179,7 @@ static std::string WindowInfoToString(const WindowInfo& wind) //Ini Ini::Ini() { - m_Config = getIniFile(); + m_Config = getIniFile(); } Ini::~Ini() @@ -246,4 +246,4 @@ WindowInfo Ini::Load(const std::string& section, const std::string& key, const W { return StringToWindowInfo(m_Config->GetValue(section.c_str(), key.c_str(), WindowInfoToString(def_value).c_str())); saveIniFile(); -} +} \ No newline at end of file diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index ba9fed46aa..543b8b4075 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -362,4 +362,4 @@ public: } }; -extern Inis Ini; +extern Inis Ini; \ No newline at end of file diff --git a/rpcs3/Loader/ELF32.cpp b/rpcs3/Loader/ELF32.cpp index 6de63abb6f..c126f51991 100644 --- a/rpcs3/Loader/ELF32.cpp +++ b/rpcs3/Loader/ELF32.cpp @@ -3,7 +3,7 @@ #include "Emu/Memory/Memory.h" #include "ELF32.h" -void WriteEhdr(wxFile& f, Elf32_Ehdr& ehdr) +void WriteEhdr(rFile& f, Elf32_Ehdr& ehdr) { Write32(f, ehdr.e_magic); Write8(f, ehdr.e_class); @@ -26,7 +26,7 @@ void WriteEhdr(wxFile& f, Elf32_Ehdr& ehdr) Write16(f, ehdr.e_shstrndx); } -void WritePhdr(wxFile& f, Elf32_Phdr& phdr) +void WritePhdr(rFile& f, Elf32_Phdr& phdr) { Write32(f, phdr.p_type); Write32(f, phdr.p_offset); @@ -38,7 +38,7 @@ void WritePhdr(wxFile& f, Elf32_Phdr& phdr) Write32(f, phdr.p_align); } -void WriteShdr(wxFile& f, Elf32_Shdr& shdr) +void WriteShdr(rFile& f, Elf32_Shdr& shdr) { Write32(f, shdr.sh_name); Write32(f, shdr.sh_type); diff --git a/rpcs3/Loader/ELF32.h b/rpcs3/Loader/ELF32.h index 5882d3ffea..c69d467585 100644 --- a/rpcs3/Loader/ELF32.h +++ b/rpcs3/Loader/ELF32.h @@ -307,6 +307,6 @@ private: bool LoadShdrData(u64 offset); }; -void WriteEhdr(wxFile& f, Elf32_Ehdr& ehdr); -void WritePhdr(wxFile& f, Elf32_Phdr& phdr); -void WriteShdr(wxFile& f, Elf32_Shdr& shdr); +void WriteEhdr(rFile& f, Elf32_Ehdr& ehdr); +void WritePhdr(rFile& f, Elf32_Phdr& phdr); +void WriteShdr(rFile& f, Elf32_Shdr& shdr); diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index a7909eeb89..63e9852770 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -7,9 +7,12 @@ #include "Emu/SysCalls/Modules.h" #include "ELF64.h" #include "Emu/Cell/PPUInstrTable.h" +#include "Emu/System.h" +#include "Emu/SysCalls/ModuleManager.h" + using namespace PPU_instr; -void WriteEhdr(wxFile& f, Elf64_Ehdr& ehdr) +void WriteEhdr(rFile& f, Elf64_Ehdr& ehdr) { Write32(f, ehdr.e_magic); Write8(f, ehdr.e_class); @@ -32,7 +35,7 @@ void WriteEhdr(wxFile& f, Elf64_Ehdr& ehdr) Write16(f, ehdr.e_shstrndx); } -void WritePhdr(wxFile& f, Elf64_Phdr& phdr) +void WritePhdr(rFile& f, Elf64_Phdr& phdr) { Write32(f, phdr.p_type); Write32(f, phdr.p_flags); @@ -44,7 +47,7 @@ void WritePhdr(wxFile& f, Elf64_Phdr& phdr) Write64(f, phdr.p_align); } -void WriteShdr(wxFile& f, Elf64_Shdr& shdr) +void WriteShdr(rFile& f, Elf64_Shdr& shdr) { Write32(f, shdr.sh_name); Write32(f, shdr.sh_type); @@ -62,6 +65,7 @@ ELF64Loader::ELF64Loader(vfsStream& f) : elf64_f(f) , LoaderBase() { + int a = 0; } bool ELF64Loader::LoadInfo() @@ -249,7 +253,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) { elf64_f.Seek(phdr_arr[i].p_offset); elf64_f.Read(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz); - StaticAnalyse(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz, phdr_arr[i].p_vaddr); + Emu.GetSFuncManager().StaticAnalyse(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz, phdr_arr[i].p_vaddr); } } break; @@ -340,7 +344,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) stub.s_text = re(stub.s_text); const std::string& module_name = Memory.ReadString(stub.s_modulename); - Module* module = GetModuleByName(module_name); + Module* module = Emu.GetModuleManager().GetModuleByName(module_name); if(module) { //module->SetLoaded(); @@ -386,7 +390,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset) mem32_ptr_t out_tbl(tbl + i*8); out_tbl += dst + i*section; - out_tbl += GetFuncNumById(nid); + out_tbl += Emu.GetModuleManager().GetFuncNumById(nid); mem32_ptr_t out_dst(dst + i*section); out_dst += OR(11, 2, 2, 0); diff --git a/rpcs3/Loader/ELF64.h b/rpcs3/Loader/ELF64.h index fc8005b5ef..4a54a08232 100644 --- a/rpcs3/Loader/ELF64.h +++ b/rpcs3/Loader/ELF64.h @@ -186,6 +186,6 @@ private: //bool LoadImports(); }; -void WriteEhdr(wxFile& f, Elf64_Ehdr& ehdr); -void WritePhdr(wxFile& f, Elf64_Phdr& phdr); -void WriteShdr(wxFile& f, Elf64_Shdr& shdr); +void WriteEhdr(rFile& f, Elf64_Ehdr& ehdr); +void WritePhdr(rFile& f, Elf64_Phdr& phdr); +void WriteShdr(rFile& f, Elf64_Shdr& shdr); diff --git a/rpcs3/Loader/Loader.h b/rpcs3/Loader/Loader.h index e630b7a947..9112eddc41 100644 --- a/rpcs3/Loader/Loader.h +++ b/rpcs3/Loader/Loader.h @@ -75,42 +75,42 @@ __forceinline static u64 Read64LE(vfsStream& f) return ((u64)Read32LE(f) | (u64)Read32LE(f) << 32); } -__forceinline static void Write8(wxFile& f, const u8 data) +__forceinline static void Write8(rFile& f, const u8 data) { f.Write(&data, 1); } -__forceinline static void Write16(wxFile& f, const u16 data) +__forceinline static void Write16(rFile& f, const u16 data) { Write8(f, data >> 8); Write8(f, data); } -__forceinline static void Write32(wxFile& f, const u32 data) +__forceinline static void Write32(rFile& f, const u32 data) { Write16(f, data >> 16); Write16(f, data); } -__forceinline static void Write64(wxFile& f, const u64 data) +__forceinline static void Write64(rFile& f, const u64 data) { Write32(f, data >> 32); Write32(f, data); } -__forceinline static void Write16LE(wxFile& f, const u16 data) +__forceinline static void Write16LE(rFile& f, const u16 data) { Write8(f, data); Write8(f, data >> 8); } -__forceinline static void Write32LE(wxFile& f, const u32 data) +__forceinline static void Write32LE(rFile& f, const u32 data) { Write16LE(f, data); Write16LE(f, data >> 16); } -__forceinline static void Write64LE(wxFile& f, const u64 data) +__forceinline static void Write64LE(rFile& f, const u64 data) { Write32LE(f, data); Write32LE(f, data >> 32); diff --git a/rpcs3/Loader/PKG.cpp b/rpcs3/Loader/PKG.cpp index 43512e16ba..f634b179a8 100644 --- a/rpcs3/Loader/PKG.cpp +++ b/rpcs3/Loader/PKG.cpp @@ -3,7 +3,7 @@ #include "PKG.h" #include "../Crypto/unpkg.h" -PKGLoader::PKGLoader(wxFile& f) : pkg_f(f) +PKGLoader::PKGLoader(rFile& f) : pkg_f(f) { } @@ -13,7 +13,7 @@ bool PKGLoader::Install(std::string dest) if (!pkg_f.IsOpened()) return false; - dest = fmt::ToUTF8(wxGetCwd()) + dest; + dest = rGetCwd() + dest; if (!dest.empty() && dest.back() != '/') dest += '/'; @@ -24,9 +24,9 @@ bool PKGLoader::Install(std::string dest) std::string titleID = std::string(title_id).substr(7, 9); - if (wxDirExists(fmt::FromUTF8(dest+titleID))) { - wxMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", wxYES_NO|wxCENTRE); - if (d_overwrite.ShowModal() != wxID_YES) { + if (rDirExists(dest+titleID)) { + rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE); + if (d_overwrite.ShowModal() != rID_YES) { ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str()); return false; } @@ -34,7 +34,7 @@ bool PKGLoader::Install(std::string dest) ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str()); return false; } - if (!wxMkdir(fmt::FromUTF8(dest+titleID))) { + if (!rMkdir(dest+titleID)) { ConLog.Error("PKG Loader: Could not make the installation directory: %s", titleID.c_str()); return false; } diff --git a/rpcs3/Loader/PKG.h b/rpcs3/Loader/PKG.h index 8c2b3da125..f616df04dd 100644 --- a/rpcs3/Loader/PKG.h +++ b/rpcs3/Loader/PKG.h @@ -3,10 +3,10 @@ class PKGLoader { - wxFile& pkg_f; + rFile& pkg_f; public: - PKGLoader(wxFile& f); + PKGLoader(rFile& f); virtual bool Install(std::string dest); virtual bool Close(); }; diff --git a/rpcs3/Loader/TROPUSR.cpp b/rpcs3/Loader/TROPUSR.cpp index 8b97d6160a..d15e8f00b4 100644 --- a/rpcs3/Loader/TROPUSR.cpp +++ b/rpcs3/Loader/TROPUSR.cpp @@ -4,8 +4,6 @@ #include "Emu/System.h" #include "TROPUSR.h" -#include "wx/xml/xml.h" - TROPUSRLoader::TROPUSRLoader() { m_file = NULL; @@ -123,19 +121,19 @@ bool TROPUSRLoader::Save(const std::string& filepath) bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& configpath) { std::string path; - wxXmlDocument doc; + rXmlDocument doc; Emu.GetVFS().GetDevice(configpath.c_str(), path); - doc.Load(fmt::FromUTF8(path)); + doc.Load(path); m_table4.clear(); m_table6.clear(); - for (wxXmlNode *n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) + for (std::shared_ptr n = doc.GetRoot()->GetChildren(); n; n = n->GetNext()) { if (n->GetName() == "trophy") { - u32 trophy_id = atoi(n->GetAttribute("id").mb_str()); + u32 trophy_id = atoi(n->GetAttribute("id").c_str()); u32 trophy_grade; - switch (((const char *)n->GetAttribute("ttype").mb_str())[0]) + switch (((const char *)n->GetAttribute("ttype").c_str())[0]) { case 'B': trophy_grade = 4; break; case 'S': trophy_grade = 3; break; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj new file mode 100644 index 0000000000..1eea900d87 --- /dev/null +++ b/rpcs3/emucore.vcxproj @@ -0,0 +1,506 @@ + + + + + Debug - MemLeak + Win32 + + + Debug - MemLeak + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {C4A10229-4712-4BD2-B63E-50D93C67A038} + emucore + + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + true + v120 + Unicode + + + StaticLibrary + false + v120 + false + Unicode + + + StaticLibrary + false + v120 + false + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(Platform)\$(Configuration)\emucore\ + + + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(Platform)\$(Configuration)\emucore\ + + + .\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(Platform)\$(Configuration)\emucore\ + + + + Level3 + Disabled + false + Use + stdafx.h + + + true + + + + + Level3 + Disabled + false + Use + _UNICODE;UNICODE;MSVC_CRT_MEMLEAK_DETECTION;%(PreprocessorDefinitions) + stdafx.h + + + true + + + + + Level3 + Disabled + false + Use + _UNICODE;UNICODE;%(PreprocessorDefinitions) + stdafx.h + + + true + + + + + Level3 + Disabled + false + Use + _UNICODE;UNICODE;MSVC_CRT_MEMLEAK_DETECTION;%(PreprocessorDefinitions) + stdafx.h + + + true + + + + + Level3 + MaxSpeed + true + true + false + Use + stdafx.h + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + false + Use + stdafx.h + + + true + true + true + + + + + + \ No newline at end of file diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters new file mode 100644 index 0000000000..af59ad9daa --- /dev/null +++ b/rpcs3/emucore.vcxproj.filters @@ -0,0 +1,926 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {d614f6ff-cd3b-40c4-8a76-1ff82b68d3d4} + + + {ad58328f-b041-41e0-ad17-dbad7d193051} + + + {d79d0db9-c3fc-480a-9979-175b82ffecf7} + + + {269371f1-45b7-4ca9-a4a7-376e6e62a8ba} + + + {4317ac27-38e4-4f8d-9bac-496f9b00f615} + + + {1df5b438-f263-4ff4-9b86-a9ea368f2106} + + + {d489f5c9-f7b7-4402-9cfb-6aa2c813cdf6} + + + {c04826b8-05a1-4015-b3aa-ef44805531a2} + + + {c344f241-48a9-4950-8b94-8b60adc4a67f} + + + {9aaa9b5c-c890-485c-a729-d2b5e783406f} + + + {f81523a6-0846-4abc-96b2-1284b2506485} + + + {b26b6b08-a8ce-4bb5-8339-c5352a23ce96} + + + {28902cf4-4fa6-428b-ab94-6b410fd5077f} + + + {13d20086-2188-425a-9856-0440fe6f79f2} + + + {037247b4-0370-4193-a25d-bc9d075bf0a7} + + + {93b1cff1-0158-4327-a437-e9abcac8d724} + + + {5a18e5b1-2632-4849-ba94-e7a2ea0b78fa} + + + {f5d19014-3c8f-43d2-bb46-af3d7f4add2b} + + + {960c535f-dabe-4f7e-b73f-fb0fac60d7c0} + + + {cd540262-1ecb-4160-a69f-95704e32f2d0} + + + {be701b55-2a3d-4692-a3bf-347681ab1c7e} + + + {84c34dd1-4c49-4ecf-8ee2-4165c14f24be} + + + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Emu + + + Emu + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\Io + + + Emu\Io + + + Emu\Io + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\HDD + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\CPU + + + Emu\CPU + + + Emu\ARMv7 + + + Emu\Audio + + + Emu\Audio + + + Emu\Audio\AL + + + Emu\Memory + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Source Files + + + Utilities + + + Utilities + + + Utilities + + + Emu\SysCalls + + + Emu\Cell + + + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Crypto + + + Emu + + + Emu + + + Emu + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\lv2 + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\SysCalls\Modules + + + Emu\Io + + + Emu\Io + + + Emu\Io + + + Emu\Io + + + Emu\Io + + + Emu\Io + + + Emu\Io\Null + + + Emu\Io\Windows + + + Emu\Io\Windows + + + Emu\Io\Windows + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\GL + + + Emu\GS\Null + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\FS + + + Emu\HDD + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\Cell + + + Emu\CPU + + + Emu\CPU + + + Emu\CPU + + + Emu\CPU + + + Emu\CPU + + + Emu\ARMv7 + + + Emu\ARMv7 + + + Emu\ARMv7 + + + Emu\ARMv7 + + + Emu\ARMv7 + + + Emu\Audio + + + Emu\Audio + + + Emu\Audio\AL + + + Emu\Memory + + + Emu\Memory + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Loader + + + Header Files + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Emu\SysCalls + + + Emu\SysCalls + + + Utilities + + + Utilities\SimpleIni + + + Utilities\SimpleIni + + + Utilities + + + Emu + + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Emu\Cell + + + \ No newline at end of file diff --git a/rpcs3/emucore.vcxproj.user b/rpcs3/emucore.vcxproj.user new file mode 100644 index 0000000000..ef5ff2a1fa --- /dev/null +++ b/rpcs3/emucore.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 199a2d30a3..f0a50e9b3f 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -5,6 +5,7 @@ #include "rpcs3.h" #include "Ini.h" #include "Gui/ConLogFrame.h" +#include "Emu/GameInfo.h" #ifdef _WIN32 #include @@ -85,4 +86,21 @@ CPUThread& GetCPU(const u8 core) return Emu.GetCPU().Get(core); }*/ +//TODOB: remove this +//convert a wxString to a std::string encoded in utf8 +//CAUTION, only use this to interface with wxWidgets classes +std::string fmt::ToUTF8(const wxString& right) +{ + auto ret = std::string(((const char *)right.utf8_str())); + return ret; +} + +//convert a std::string encoded in utf8 to a wxString +//CAUTION, only use this to interface with wxWidgets classes +wxString fmt::FromUTF8(const std::string& right) +{ + auto ret = wxString::FromUTF8(right.c_str()); + return ret; +} + GameInfo CurGameInfo; diff --git a/rpcs3/rpcs3.h b/rpcs3/rpcs3.h index 4ee43a327c..f99984ddb7 100644 --- a/rpcs3/rpcs3.h +++ b/rpcs3/rpcs3.h @@ -5,40 +5,6 @@ class CPUThread; wxDECLARE_EVENT(wxEVT_DBG_COMMAND, wxCommandEvent); -enum DbgCommand -{ - DID_FIRST_COMMAND = 0x500, - - DID_START_EMU, - DID_STARTED_EMU, - DID_STOP_EMU, - DID_STOPPED_EMU, - DID_PAUSE_EMU, - DID_PAUSED_EMU, - DID_RESUME_EMU, - DID_RESUMED_EMU, - DID_READY_EMU, - DID_CREATE_THREAD, - DID_CREATED_THREAD, - DID_REMOVE_THREAD, - DID_REMOVED_THREAD, - DID_RENAME_THREAD, - DID_RENAMED_THREAD, - DID_START_THREAD, - DID_STARTED_THREAD, - DID_STOP_THREAD, - DID_STOPED_THREAD, - DID_PAUSE_THREAD, - DID_PAUSED_THREAD, - DID_RESUME_THREAD, - DID_RESUMED_THREAD, - DID_EXEC_THREAD, - DID_REGISTRED_CALLBACK, - DID_UNREGISTRED_CALLBACK, - DID_EXIT_THR_SYSCALL, - - DID_LAST_COMMAND, -}; class Rpcs3App : public wxApp { diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index ff0f4476a2..d0e69a97e9 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -1,26 +1,14 @@  - - Debug - MemLeak - Win32 - Debug - MemLeak x64 - - Debug - Win32 - Debug x64 - - Release - Win32 - Release x64 @@ -32,18 +20,6 @@ rpcs3 - - Application - true - Unicode - v120 - - - Application - true - Unicode - v120 - Application true @@ -56,14 +32,6 @@ Unicode v120 - - Application - false - true - Unicode - v120 - false - Application false @@ -75,37 +43,16 @@ - - - - - - - - - - - .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit - $(SolutionDir)bin\ - ..\libs\$(Configuration)\;$(LibraryPath) - $(ProjectName)-$(PlatformShortName)-dbg - - - .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;.\OpenAL\include;$(IncludePath) - $(SolutionDir)bin\ - ..\libs\$(Configuration)\;$(LibraryPath) - $(ProjectName)-$(PlatformShortName)-dbg - .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit $(SolutionDir)bin\ @@ -118,15 +65,6 @@ ..\libs\$(Configuration)\;$(LibraryPath) $(ProjectName)-$(PlatformShortName)-dbg - - false - .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit - $(SolutionDir)bin\ - ..\libs\$(Configuration)\;$(LibraryPath) - false - false - $(ProjectName)-$(PlatformShortName) - false .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit @@ -136,48 +74,6 @@ false $(ProjectName)-$(PlatformShortName) - - - Level3 - Disabled - EditAndContinue - Use - true - ..\wxWidgets\include\msvc - - - true - wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) - %(IgnoreSpecificDefaultLibraries) - false - ..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib;..\OpenAL\Win32 - - - - - - - - - Level3 - Disabled - EditAndContinue - Use - true - ..\wxWidgets\include\msvc - - - true - wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) - %(IgnoreSpecificDefaultLibraries) - false - ..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib;..\OpenAL\Win32 - - - - - - Level3 @@ -188,7 +84,7 @@ true - wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\emucore.lib;wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) false ..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib;..\OpenAL\Win64 @@ -211,7 +107,7 @@ true - wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\emucore.lib;wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) false ..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib;..\OpenAL\Win64 @@ -223,38 +119,6 @@ false - - - TurnOffAllWarnings - Full - true - true - ..\wxWidgets\include\msvc - MultiThreadedDLL - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - false - Use - Speed - Sync - false - - - Windows - true - true - true - wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) - - - %(IgnoreSpecificDefaultLibraries) - false - ..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib;..\OpenAL\Win32 - - - - - - Level3 @@ -276,7 +140,7 @@ true true true - wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\emucore.lib;wxmsw31u_adv.lib;wxbase31u.lib;wxmsw31u_core.lib;wxmsw31u_aui.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;wsock32.lib;wininet.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;libOpenAL32.dll.a;asmjit.lib;%(AdditionalDependencies) %(IgnoreSpecificDefaultLibraries) @@ -289,172 +153,24 @@ + + + + + + - - - - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -465,21 +181,9 @@ - - - - - - - - - - Create Create - Create - Create Create Create @@ -492,145 +196,28 @@ + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -641,15 +228,6 @@ - - - - - - - - - diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 854c30c41b..23360f567c 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -10,73 +10,9 @@ {47155d25-741d-42c0-8850-f22aafca082a} - - {f306c137-6d2c-4e21-ba79-ac87d0ded22c} - - - {adfec460-d940-4482-9fdb-18cb0814c3d5} - true - - - {6c36f15e-07fd-45d6-a81c-1ab43ee1b58b} - - - {57263311-75a4-4309-81aa-b86fd212794b} - - - {461eddb5-b8a8-46be-918c-98cc7eaf995b} - - - {e79e49c8-6967-4776-8f50-5479c3821b51} - {9bd88f78-8528-48f3-b9e0-78e06476b04d} - - {fd7cea02-e77f-41b1-8b61-f78e7d280e04} - - - {dfd581c4-aed0-4229-bb30-7ee5816049e1} - - - {718bc358-b7ef-4988-8547-2148d14bb08b} - - - {f66e37f9-5e58-443b-bcff-2e9e002ac89e} - - - {041a844e-9f8b-4b4b-a4c5-6c72ecbde475} - - - {bee6a4b4-6371-4c1b-8558-fc7888b1574e} - - - {46cb6261-7ba2-4511-b576-4b491c04bed8} - - - {28cf8d4a-ff56-45ef-a824-3bd71c626257} - - - {e9937271-a8ff-49f6-a326-c4659f96703f} - - - {8e0f4d81-cb1a-4f3a-ae11-704ead4e1826} - - - {ee9b80ba-467b-47d0-9e20-670fec13ef5d} - - - {16f84899-2e1c-4033-8832-f1b6abb2056b} - - - {899523fa-c26a-44ea-b272-73c4585e3821} - - - {a77ab520-4399-4c95-a7ee-985c9a5ad694} - - - {c7dba541-6b78-47fd-b1aa-2325317a8bf0} - @@ -97,180 +33,24 @@ Gui - - Emu - rpcs3 Gui - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - Gui - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - Gui - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Emu\Cell - - - Emu\Cell - - - Emu\SysCalls - - - Emu\SysCalls\lv2 - - - Emu\Io - - - Emu - - - Emu\GS - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS - - - Emu\SysCalls\lv2 - - - Emu\GS - - - Emu\Cell - - - Emu\SysCalls\lv2 - Utilities - - Emu\SysCalls - - - Emu\SysCalls\lv2 - - - Emu\SysCalls - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - Gui - - Emu\Cell - - - Emu\SysCalls\lv2 - - - Emu\SysCalls - - - Emu\SysCalls\Modules - - - Emu\Cell - - - Emu\Cell - - - Emu\HDD - Gui @@ -280,96 +60,6 @@ Gui - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\Io - - - Emu\SysCalls\lv2 - - - Emu\Io - - - Emu\SysCalls\lv2 - - - Emu\FS - - - Emu\CPU - - - Emu\CPU - - - Emu\Cell - - - Emu\ARMv7 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\SysCalls\Modules - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\Modules - - - Emu\Audio - - - Emu\SysCalls\Modules - Gui @@ -379,245 +69,41 @@ Gui - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\lv2 - - - Emu\FS - - - Emu\FS - Utilities - - Emu\SysCalls\lv2 - - - Emu\SysCalls\Modules - - - Emu\SysCalls - - - Loader - - - Emu\GS - - - Emu\SysCalls\Modules - - - Emu\FS - - - Emu\FS - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Loader - - - Emu\SysCalls\Modules - - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Emu\SysCalls - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\Audio - - - Emu\Audio\AL - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\lv2 - - - Loader - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Crypto - - - Emu\Cell - Utilities - - Emu\Cell + + Utilities - - Emu\Memory + + Utilities - - Crypto + + Utilities - - Emu\Io\XInput + + Utilities - - Emu\SysCalls\Modules\currently_unused + + Utilities - - Emu\SysCalls\Modules\currently_unused + + Utilities - - Emu\SysCalls\Modules\currently_unused + + Gui - - Emu\SysCalls\Modules\currently_unused + + Gui - - Emu\SysCalls\Modules\currently_unused + + Gui - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused - - - Emu\SysCalls\Modules\currently_unused + + Emu @@ -648,27 +134,6 @@ Utilities - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Crypto - - - Crypto - Utilities @@ -708,96 +173,6 @@ Gui - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Loader - - - Emu\Audio - - - Emu\Audio - - - Emu\Audio\AL - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\CPU - - - Emu\CPU - - - Emu\CPU - - - Emu\CPU - - - Emu\CPU - - - Emu - - - Emu\Memory - - - Emu\Memory - - - Emu - rpcs3 @@ -813,308 +188,41 @@ Gui - - Emu\GS - - - Emu\GS - - - Emu\GS - - - Emu\GS - - - Emu\GS - - - Emu\GS - - - Emu\GS\Null - - - Emu\GS - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu\GS\GL - - - Emu - - - Emu\Io - - - Emu\Io - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Cell - - - Emu\Io\Null - - - Emu\Io - - - Emu\Io - - - Emu\Io - - - Emu\Io\Windows - - - Emu\Io\Windows - - - Emu\Io\Windows - - - Emu\SysCalls - - - Emu\SysCalls - - - Emu\ARMv7 - - - Emu\ARMv7 - - - Emu\ARMv7 - - - Emu\ARMv7 - - - Emu\ARMv7 - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\FS - - - Emu\HDD - - - Emu\Io - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls\lv2 - - - Emu\SysCalls - - - Emu\SysCalls - - - Emu\SysCalls - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\SysCalls\Modules - - - Emu\Cell - - - Emu\Cell - - - Crypto - Gui - - Emu\Io\XInput - Emu - - Emu\SysCalls\Modules\currently_unused + + Utilities - - Emu\SysCalls\Modules\currently_unused + + Utilities - - Emu\SysCalls\lv2 + + Utilities + + + Utilities + + + Utilities + + + Utilities + + + Gui + + + Gui + + + Gui + + + Gui \ No newline at end of file diff --git a/rpcs3/rpcs3.vcxproj.user b/rpcs3/rpcs3.vcxproj.user index b03467fb6a..02ce42b74d 100644 --- a/rpcs3/rpcs3.vcxproj.user +++ b/rpcs3/rpcs3.vcxproj.user @@ -1,15 +1,15 @@  - $(SolutionDir)bin\ + $(SolutionDir)..\rpcs3_bin\ WindowsLocalDebugger - $(SolutionDir)bin\ + $(SolutionDir)..\rpcs3_bin\ WindowsLocalDebugger - $(SolutionDir)bin\ + $(SolutionDir)..\rpcs3_bin\ WindowsLocalDebugger diff --git a/rpcs3/stdafx.cpp b/rpcs3/stdafx.cpp index 1577c4e3bc..fd4f341c7b 100644 --- a/rpcs3/stdafx.cpp +++ b/rpcs3/stdafx.cpp @@ -1 +1 @@ -#include "stdafx.h" \ No newline at end of file +#include "stdafx.h" diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index cafdb54861..641cd68ca2 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -6,12 +6,16 @@ #include #endif -#define NOMINMAX +/* size of statically declared array */ +#define SARRSIZEOF(array) (sizeof(array)/sizeof(array[0])) +#define NOMINMAX +//#ifdef wxGUI #ifndef QT_UI #ifdef _WIN32 -#include +//#include #endif +#include #include #include #include @@ -37,9 +41,10 @@ #include #include "wx/app.h" #include +#include -#include #endif +//#endif #ifdef MSVC_CRT_MEMLEAK_DETECTION #ifdef _DEBUG @@ -274,19 +279,30 @@ enum Status }; #include "Utilities/BEType.h" +#include "Utilities/rFile.h" +#include "Utilities/rTime.h" +#include "Utilities/rXml.h" +#include "Utilities/rConcurrency.h" +#include "Utilities/rMsgBox.h" +#include "Utilities/rPlatform.h" #include "Utilities/Thread.h" #include "Utilities/Array.h" #include "Utilities/Timer.h" #include "Utilities/IdManager.h" #include "Utilities/StrFmt.h" -#include "Emu/SysCalls/Callback.h" -#include "Ini.h" -#include "Gui/FrameBase.h" -#include "Gui/ConLogFrame.h" #include "Emu/ConLog.h" +#include "Emu/DbgConsole.h" +#include "rpcs3/Ini.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" +#include "Emu/SysCalls/Callback.h" +#include "Emu/DbgCommand.h" +//#ifdef wxGUI +#include "Gui/FrameBase.h" +#include "Gui/DbgFrame.h" +#include "Gui/ConLogFrame.h" +//#endif #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/Modules.h" @@ -300,6 +316,7 @@ enum Status #include "Emu/FS/vfsStreamMemory.h" #include "Emu/FS/vfsFile.h" #include "Emu/FS/vfsDir.h" +//#ifdef wxGUI #include "rpcs3.h" #define _PRGNAME_ "RPCS3" From 314307b84068c04e1772c750cea0b2f501ec0451 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Sun, 8 Jun 2014 13:43:13 +0200 Subject: [PATCH 2/5] Fix building with precompiled headers add the unimplemented modules to the emucore project fix a bug in the rXml wrapper that didn't consider the possiblity of functions returning null pointers --- Utilities/rPlatform.cpp | 52 ++++++++++----- Utilities/rXml.cpp | 18 +++++- rpcs3/emucore.vcxproj | 41 +++++++++++- rpcs3/emucore.vcxproj.filters | 118 +++++++++++++++++++++++++++++++++- rpcs3/rpcs3.vcxproj | 2 +- 5 files changed, 209 insertions(+), 22 deletions(-) diff --git a/Utilities/rPlatform.cpp b/Utilities/rPlatform.cpp index d309feb13e..2fa307fb58 100644 --- a/Utilities/rPlatform.cpp +++ b/Utilities/rPlatform.cpp @@ -11,6 +11,10 @@ #include "Emu/Io/Null/NullPadHandler.h" #include "Emu/Io/Windows/WindowsPadHandler.h" +#if defined(_WIN32) +#include "Emu/Io/XInput/XInputPadHandler.h" +#endif + rCanvas::rCanvas(void *parent) { @@ -118,13 +122,16 @@ int rPlatform::getKeyboardHandlerCount() KeyboardHandlerBase *rPlatform::getKeyboardHandler(int i) { - if (i == 0) + switch (i) { - return new NullKeyboardHandler(); - } - else if (i == 1) - { - return new WindowsKeyboardHandler(); + case 0: + return new NullKeyboardHandler(); + break; + case 1: + return new WindowsKeyboardHandler(); + break; + default: + return new NullKeyboardHandler(); } } @@ -136,30 +143,45 @@ int rPlatform::getMouseHandlerCount() MouseHandlerBase *rPlatform::getMouseHandler(int i) { - if (i == 0) + switch (i) { + case 0: return new NullMouseHandler(); - } - else if (i == 1) - { + break; + case 1: return new WindowsMouseHandler(); + break; + default: + return new NullMouseHandler(); } } int rPlatform::getPadHandlerCount() { +#if defined(_WIN32) + return 3; +#else return 2; +#endif } PadHandlerBase *rPlatform::getPadHandler(int i) { - if (i == 0) + switch (i) { + case 0: + return new NullPadHandler(); + break; + case 1: + return new WindowsPadHandler(); + break; +#if defined(_WIN32) + case 2: + return new XInputPadHandler(); + break; +#endif + default: return new NullPadHandler(); } - else if (i == 1) - { - return new WindowsPadHandler(); - } } \ No newline at end of file diff --git a/Utilities/rXml.cpp b/Utilities/rXml.cpp index 089b88114d..62da3d4c0c 100644 --- a/Utilities/rXml.cpp +++ b/Utilities/rXml.cpp @@ -44,13 +44,27 @@ rXmlNode::~rXmlNode() std::shared_ptr rXmlNode::GetChildren() { wxXmlNode* result = reinterpret_cast(handle)->GetChildren(); - return std::make_shared(reinterpret_cast(result)); + if (result) + { + return std::make_shared(reinterpret_cast(result)); + } + else + { + return std::shared_ptr(nullptr); + } } std::shared_ptr rXmlNode::GetNext() { wxXmlNode* result = reinterpret_cast(handle)->GetNext(); - return std::make_shared(reinterpret_cast(result)); + if (result) + { + return std::make_shared(reinterpret_cast(result)); + } + else + { + return std::shared_ptr(nullptr); + } } std::string rXmlNode::GetName() diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 1eea900d87..706c2e44e5 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -52,6 +52,7 @@ + @@ -120,39 +121,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -215,6 +250,7 @@ + @@ -306,6 +342,8 @@ + + @@ -313,7 +351,6 @@ - diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index af59ad9daa..adf0547ca4 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -75,6 +75,9 @@ {84c34dd1-4c49-4ecf-8ee2-4165c14f24be} + + {ead7494f-a872-4b4d-a864-1a61c3b6012f} + @@ -461,9 +464,114 @@ Emu\SysCalls - + Emu\Cell + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + @@ -919,8 +1027,14 @@ Utilities - + Emu\Cell + + Emu\Cell\currently_unused + + + Emu\Cell\currently_unused + \ No newline at end of file diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index d0e69a97e9..aaafa6aa15 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -73,7 +73,7 @@ false false $(ProjectName)-$(PlatformShortName) - + Level3 From 10e10de98d119052abded8190779013e0e5aad4a Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Sun, 8 Jun 2014 15:57:37 +0200 Subject: [PATCH 3/5] add xinput pad handler to the windows emucore --- rpcs3/emucore.vcxproj | 2 ++ rpcs3/emucore.vcxproj.filters | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 706c2e44e5..22759f96d8 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -188,6 +188,7 @@ + @@ -351,6 +352,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index adf0547ca4..8b0787ecba 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -78,6 +78,9 @@ {ead7494f-a872-4b4d-a864-1a61c3b6012f} + + {187d33b8-7b69-4081-9545-de6ad1d8fe98} + @@ -572,6 +575,9 @@ Emu\Cell\currently_unused + + Emu\Io\XInput + @@ -1036,5 +1042,8 @@ Emu\Cell\currently_unused + + Emu\Io\XInput + \ No newline at end of file From ed10ea754438e4ef58ec51b095ba471ee44c5895 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Sun, 8 Jun 2014 23:02:20 +0200 Subject: [PATCH 4/5] add back fused gui log classes, this needs to be redone another way also, add back wx requirement for strfmt --- Utilities/StrFmt.cpp | 33 ++++--- rpcs3/Emu/DbgConsole.cpp | 131 +++++++++++++------------- rpcs3/Emu/DbgConsole.h | 164 +++++++++++++++----------------- rpcs3/Gui/ConLog.cpp | 170 ++++++++++++++++++++++++++++++++-- rpcs3/Gui/DbgFrame.cpp | 94 ------------------- rpcs3/Gui/DbgFrame.h | 23 ----- rpcs3/emucore.vcxproj | 2 - rpcs3/emucore.vcxproj.filters | 6 -- rpcs3/rpcs3.cpp | 17 ---- rpcs3/rpcs3.vcxproj | 6 +- rpcs3/rpcs3.vcxproj.filters | 12 +-- rpcs3/stdafx.h | 7 +- 12 files changed, 332 insertions(+), 333 deletions(-) delete mode 100644 rpcs3/Gui/DbgFrame.cpp delete mode 100644 rpcs3/Gui/DbgFrame.h diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 259b3c0ce3..2ee8d8c9f6 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -54,23 +54,22 @@ std::string replace_all(std::string src, const std::string& from, const std::str return src; } -//#ifdef wxGUI -////convert a wxString to a std::string encoded in utf8 -////CAUTION, only use this to interface with wxWidgets classes -//std::string fmt::ToUTF8(const wxString& right) -//{ -// auto ret = std::string(((const char *) right.utf8_str())); -// return ret; -//} -// -////convert a std::string encoded in utf8 to a wxString -////CAUTION, only use this to interface with wxWidgets classes -//wxString fmt::FromUTF8(const std::string& right) -//{ -// auto ret = wxString::FromUTF8(right.c_str()); -// return ret; -//} -//#endif +//TODO: move this wx Stuff somewhere else +//convert a wxString to a std::string encoded in utf8 +//CAUTION, only use this to interface with wxWidgets classes +std::string fmt::ToUTF8(const wxString& right) +{ + auto ret = std::string(((const char *)right.utf8_str())); + return ret; +} + +//convert a std::string encoded in utf8 to a wxString +//CAUTION, only use this to interface with wxWidgets classes +wxString fmt::FromUTF8(const std::string& right) +{ + auto ret = wxString::FromUTF8(right.c_str()); + return ret; +} //TODO: remove this after every snippet that uses it is gone //WARNING: not fully compatible with CmpNoCase from wxString diff --git a/rpcs3/Emu/DbgConsole.cpp b/rpcs3/Emu/DbgConsole.cpp index 11bab7990e..3e9605cbbd 100644 --- a/rpcs3/Emu/DbgConsole.cpp +++ b/rpcs3/Emu/DbgConsole.cpp @@ -4,91 +4,94 @@ #include "Emu/System.h" #include "DbgConsole.h" -LogWriter ConLog; -class LogFrame; -extern LogFrame* ConLogFrame; +BEGIN_EVENT_TABLE(DbgConsole, FrameBase) +EVT_CLOSE(DbgConsole::OnQuit) +END_EVENT_TABLE() -_LogBuffer LogBuffer; - -std::mutex g_cs_conlog; - -const uint max_item_count = 500; -const uint buffer_size = 1024 * 64; - -static const std::string g_log_colors[] = +DbgConsole::DbgConsole() +: FrameBase(nullptr, wxID_ANY, "Debug Console", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) +, ThreadBase("DbgConsole thread") +, m_output(nullptr) { - "Black", "Green", "White", "Yellow", "Red", -}; + m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, + wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); + m_console->SetBackgroundColour(wxColor("Black")); + m_console->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); -LogWriter::LogWriter() -{ - if (!m_logfile.Open(_PRGNAME_ ".log", rFile::write)) - { - rMessageBox("Can't create log file! (" _PRGNAME_ ".log)", rMessageBoxCaptionStr, rICON_ERROR); - } + m_color_white = new wxTextAttr(wxColour(255, 255, 255)); + m_color_red = new wxTextAttr(wxColour(255, 0, 0)); + + if (Ini.HLESaveTTY.GetValue()) + m_output = new wxFile("tty.log", wxFile::write); } -void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/) +DbgConsole::~DbgConsole() { - std::string new_prefix = prefix; - if (!prefix.empty()) + ThreadBase::Stop(); + m_dbg_buffer.Flush(); + + safe_delete(m_console); + safe_delete(m_color_white); + safe_delete(m_color_red); + safe_delete(m_output); +} + +void DbgConsole::Write(int ch, const std::string& text) +{ + while (m_dbg_buffer.IsBusy()) { - if (NamedThreadBase* thr = GetCurrentNamedThread()) + if (Emu.IsStopped()) { - new_prefix += " : " + thr->GetThreadName(); + return; } + Sleep(1); } + m_dbg_buffer.Push(DbgPacket(ch, text)); - if (m_logfile.IsOpened() && !new_prefix.empty()) - m_logfile.Write("[" + new_prefix + "]: " + value + "\n"); + if (!IsAlive()) Start(); +} - if (!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) - return; +void DbgConsole::Clear() +{ + m_console->Clear(); +} - std::lock_guard lock(g_cs_conlog); - - // TODO: Use ThreadBase instead, track main thread id - if (rThread::IsMain()) +void DbgConsole::Task() +{ + while (!TestDestroy()) { - while (LogBuffer.IsBusy()) - { - // need extra break condition? - rYieldIfNeeded(); - } - } - else - { - while (LogBuffer.IsBusy()) + if (!m_dbg_buffer.HasNewPacket()) { if (Emu.IsStopped()) { break; } Sleep(1); + continue; } + + DbgPacket packet = m_dbg_buffer.Pop(); + m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white); + m_console->SetInsertionPointEnd(); + m_console->WriteText(fmt::FromUTF8(packet.m_text)); + + if (m_output && Ini.HLESaveTTY.GetValue()) + m_output->Write(fmt::FromUTF8(packet.m_text)); + + if (!DbgConsole::IsShown()) Show(); + } +} + +void DbgConsole::OnQuit(wxCloseEvent& event) +{ + ThreadBase::Stop(false); + Hide(); + + if (m_output) + { + m_output->Close(); + m_output = nullptr; } - //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); - - LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); -} - - -void LogWriter::SkipLn() -{ - WriteToLog("", "", 0); -} - -void DbgConsole::Close() -{ - i = 1; -} - -void DbgConsole::Clear() -{ - i = 2; -} - -void DbgConsole::Write(int ch, const std::string &msg) -{ + //event.Skip(); } diff --git a/rpcs3/Emu/DbgConsole.h b/rpcs3/Emu/DbgConsole.h index ce17097552..83ea344da6 100644 --- a/rpcs3/Emu/DbgConsole.h +++ b/rpcs3/Emu/DbgConsole.h @@ -2,8 +2,61 @@ #include //for memset -extern const uint max_item_count; -extern const uint buffer_size; +//struct _DbgBuffer : public MTPacketBuffer +//{ +// _DbgBuffer() : MTPacketBuffer(1024) +// { +// } +// +// void _push(const DbgPacket& data) +// { +// const u32 stext = data.m_text.length(); +// +// m_buffer.resize(m_buffer.size() + sizeof(int) + sizeof(u32) + stext); +// +// u32 c_put = m_put; +// +// memcpy(&m_buffer[c_put], &data.m_ch, sizeof(int)); +// c_put += sizeof(int); +// +// memcpy(&m_buffer[c_put], &stext, sizeof(u32)); +// c_put += sizeof(u32); +// memcpy(&m_buffer[c_put], data.m_text.data(), stext); +// c_put += stext; +// +// m_put = c_put; +// CheckBusy(); +// } +// +// DbgPacket _pop() +// { +// DbgPacket ret; +// +// u32 c_get = m_get; +// +// ret.m_ch = *(int*)&m_buffer[c_get]; +// c_get += sizeof(int); +// +// const u32& stext = *(u32*)&m_buffer[c_get]; +// c_get += sizeof(u32); +// if (stext) ret.m_text = std::string(reinterpret_cast(&m_buffer[c_get]), stext ); +// c_get += stext; +// +// m_get = c_get; +// if(!HasNewPacket()) Flush(); +// +// return ret; +// } +//}; +// +//struct DbgConsole +//{ +// void *congui; +// DbgConsole(); +// void Close(); +// void Clear(); +// void Write(int ch, const std::string &msg); +//}; struct DbgPacket { @@ -26,87 +79,6 @@ struct DbgPacket } }; -struct LogPacket -{ - const std::string m_prefix; - const std::string m_text; - const std::string m_colour; - - LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) - : m_prefix(prefix) - , m_text(text) - , m_colour(colour) - { - - } -}; - -struct _LogBuffer : public MTPacketBuffer -{ - _LogBuffer() : MTPacketBuffer(buffer_size) - { - } - - void _push(const LogPacket& data) - { - const u32 sprefix = data.m_prefix.length(); - const u32 stext = data.m_text.length(); - const u32 scolour = data.m_colour.length(); - - m_buffer.resize(m_buffer.size() + - sizeof(u32) + sprefix + - sizeof(u32) + stext + - sizeof(u32) + scolour); - - u32 c_put = m_put; - - memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); - c_put += sprefix; - - memcpy(&m_buffer[c_put], &stext, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); - c_put += stext; - - memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); - c_put += scolour; - - m_put = c_put; - CheckBusy(); - } - - LogPacket _pop() - { - u32 c_get = m_get; - - const u32& sprefix = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string prefix((const char*)&m_buffer[c_get], sprefix); - c_get += sprefix; - - const u32& stext = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string text((const char*)&m_buffer[c_get], stext); - c_get += stext; - - const u32& scolour = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string colour((const char*)&m_buffer[c_get], scolour); - c_get += scolour; - - m_get = c_get; - if (!HasNewPacket()) Flush(); - - return LogPacket(prefix, text, colour); - } -}; - -extern _LogBuffer LogBuffer; - struct _DbgBuffer : public MTPacketBuffer { _DbgBuffer() : MTPacketBuffer(1024) @@ -144,20 +116,34 @@ struct _DbgBuffer : public MTPacketBuffer const u32& stext = *(u32*)&m_buffer[c_get]; c_get += sizeof(u32); - if (stext) ret.m_text = std::string(reinterpret_cast(&m_buffer[c_get]), stext ); + if (stext) ret.m_text = std::string(reinterpret_cast(&m_buffer[c_get]), stext); c_get += stext; m_get = c_get; - if(!HasNewPacket()) Flush(); + if (!HasNewPacket()) Flush(); return ret; } }; -struct DbgConsole +class DbgConsole + : public FrameBase + , public ThreadBase { - int i; - void Close(); + wxFile* m_output; + wxTextCtrl* m_console; + wxTextAttr* m_color_white; + wxTextAttr* m_color_red; + _DbgBuffer m_dbg_buffer; + +public: + DbgConsole(); + ~DbgConsole(); + void Write(int ch, const std::string& text); void Clear(); - void Write(int ch, const std::string &msg); + virtual void Task(); + +private: + void OnQuit(wxCloseEvent& event); + DECLARE_EVENT_TABLE(); }; \ No newline at end of file diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 870d3b7204..210600bd4a 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -15,17 +15,171 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" +LogWriter ConLog; +class LogFrame; +extern LogFrame* ConLogFrame; + +std::mutex g_cs_conlog; + +const uint max_item_count = 500; +const uint buffer_size = 1024 * 64; + +static const std::string g_log_colors[] = +{ + "Black", "Green", "White", "Yellow", "Red", +}; + + +struct LogPacket +{ + const std::string m_prefix; + const std::string m_text; + const std::string m_colour; + + LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) + : m_prefix(prefix) + , m_text(text) + , m_colour(colour) + { + + } +}; + +struct _LogBuffer : public MTPacketBuffer +{ + _LogBuffer() : MTPacketBuffer(buffer_size) + { + } + + void _push(const LogPacket& data) + { + const u32 sprefix = data.m_prefix.length(); + const u32 stext = data.m_text.length(); + const u32 scolour = data.m_colour.length(); + + m_buffer.resize(m_buffer.size() + + sizeof(u32) + sprefix + + sizeof(u32) + stext + + sizeof(u32) + scolour); + + u32 c_put = m_put; + + memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); + c_put += sprefix; + + memcpy(&m_buffer[c_put], &stext, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); + c_put += stext; + + memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); + c_put += sizeof(u32); + memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); + c_put += scolour; + + m_put = c_put; + CheckBusy(); + } + + LogPacket _pop() + { + u32 c_get = m_get; + + const u32& sprefix = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string prefix((const char*)&m_buffer[c_get], sprefix); + c_get += sprefix; + + const u32& stext = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string text((const char*)&m_buffer[c_get], stext); + c_get += stext; + + const u32& scolour = *(u32*)&m_buffer[c_get]; + c_get += sizeof(u32); + const std::string colour((const char*)&m_buffer[c_get], scolour); + c_get += scolour; + + m_get = c_get; + if (!HasNewPacket()) Flush(); + + return LogPacket(prefix, text, colour); + } +}; + +_LogBuffer LogBuffer; + +LogWriter::LogWriter() +{ + if (!m_logfile.Open(_PRGNAME_ ".log", rFile::write)) + { + rMessageBox("Can't create log file! (" _PRGNAME_ ".log)", rMessageBoxCaptionStr, rICON_ERROR); + } +} + +void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/) +{ + std::string new_prefix = prefix; + if (!prefix.empty()) + { + if (NamedThreadBase* thr = GetCurrentNamedThread()) + { + new_prefix += " : " + thr->GetThreadName(); + } + } + + if (m_logfile.IsOpened() && !new_prefix.empty()) + m_logfile.Write("[" + new_prefix + "]: " + value + "\n"); + + if (!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) + return; + + std::lock_guard lock(g_cs_conlog); + + // TODO: Use ThreadBase instead, track main thread id + if (rThread::IsMain()) + { + while (LogBuffer.IsBusy()) + { + // need extra break condition? + rYieldIfNeeded(); + } + } + else + { + while (LogBuffer.IsBusy()) + { + if (Emu.IsStopped()) + { + break; + } + Sleep(1); + } + } + + //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); + + LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); +} + + +void LogWriter::SkipLn() +{ + WriteToLog("", "", 0); +} LogFrame* ConLogFrame; BEGIN_EVENT_TABLE(LogFrame, wxPanel) - EVT_CLOSE(LogFrame::OnQuit) +EVT_CLOSE(LogFrame::OnQuit) END_EVENT_TABLE() LogFrame::LogFrame(wxWindow* parent) - : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 500)) - , ThreadBase("LogThread") - , m_log(*new wxListView(this)) +: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 500)) +, ThreadBase("LogThread") +, m_log(*new wxListView(this)) { m_log.InsertColumn(0, "Thread"); m_log.InsertColumn(1, "Log"); @@ -35,7 +189,7 @@ LogFrame::LogFrame(wxWindow* parent) s_main->Add(&m_log, 1, wxEXPAND); SetSizer(s_main); Layout(); - + Show(); ThreadBase::Start(); } @@ -53,9 +207,9 @@ bool LogFrame::Close(bool force) void LogFrame::Task() { - while(!TestDestroy()) + while (!TestDestroy()) { - if(!LogBuffer.HasNewPacket()) + if (!LogBuffer.HasNewPacket()) { Sleep(1); continue; @@ -99,4 +253,4 @@ void LogFrame::OnQuit(wxCloseEvent& event) Stop(false); ConLogFrame = nullptr; event.Skip(); -} +} \ No newline at end of file diff --git a/rpcs3/Gui/DbgFrame.cpp b/rpcs3/Gui/DbgFrame.cpp deleted file mode 100644 index 9f966fd932..0000000000 --- a/rpcs3/Gui/DbgFrame.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "stdafx.h" -#include "DbgFrame.h" - -BEGIN_EVENT_TABLE(DbgFrame, FrameBase) -EVT_CLOSE(DbgFrame::OnQuit) -END_EVENT_TABLE() - -DbgFrame::DbgFrame() -: FrameBase(nullptr, wxID_ANY, "DbgFrame", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) -, ThreadBase("DbgFrame thread") -, m_output(nullptr) -{ - m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, - wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); - m_console->SetBackgroundColour(wxColor("Black")); - m_console->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); - - m_color_white = new wxTextAttr(wxColour(255, 255, 255)); - m_color_red = new wxTextAttr(wxColour(255, 0, 0)); - - if (Ini.HLESaveTTY.GetValue()) - m_output = new rFile("tty.log", rFile::write); -} - -DbgFrame::~DbgFrame() -{ - ThreadBase::Stop(); - m_dbg_buffer.Flush(); - - safe_delete(m_console); - safe_delete(m_color_white); - safe_delete(m_color_red); - safe_delete(m_output); -} - -void DbgFrame::Write(int ch, const std::string& text) -{ - while (m_dbg_buffer.IsBusy()) - { - if (Emu.IsStopped()) - { - return; - } - Sleep(1); - } - m_dbg_buffer.Push(DbgPacket(ch, text)); - - if (!IsAlive()) Start(); -} - -void DbgFrame::Clear() -{ - m_console->Clear(); -} - -void DbgFrame::Task() -{ - while (!TestDestroy()) - { - if (!m_dbg_buffer.HasNewPacket()) - { - if (Emu.IsStopped()) - { - break; - } - Sleep(1); - continue; - } - - DbgPacket packet = m_dbg_buffer.Pop(); - m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white); - m_console->SetInsertionPointEnd(); - m_console->WriteText(fmt::FromUTF8(packet.m_text)); - - if (m_output && Ini.HLESaveTTY.GetValue()) - m_output->Write(packet.m_text); - - if (!DbgFrame::IsShown()) Show(); - } -} - -void DbgFrame::OnQuit(wxCloseEvent& event) -{ - ThreadBase::Stop(false); - Hide(); - - if (m_output) - { - m_output->Close(); - m_output = nullptr; - } - - //event.Skip(); -} \ No newline at end of file diff --git a/rpcs3/Gui/DbgFrame.h b/rpcs3/Gui/DbgFrame.h deleted file mode 100644 index d6dda5d873..0000000000 --- a/rpcs3/Gui/DbgFrame.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -class DbgFrame - : public FrameBase - , public ThreadBase -{ - rFile* m_output; - wxTextCtrl* m_console; - wxTextAttr* m_color_white; - wxTextAttr* m_color_red; - _DbgBuffer m_dbg_buffer; - -public: - DbgFrame(); - ~DbgFrame(); - void Write(int ch, const std::string& text); - void Clear(); - virtual void Task(); - -private: - void OnQuit(wxCloseEvent& event); - DECLARE_EVENT_TABLE(); -}; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index 22759f96d8..98c3d61ac6 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -60,7 +60,6 @@ - @@ -268,7 +267,6 @@ - diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 8b0787ecba..0e7e6156ab 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -107,9 +107,6 @@ Crypto - - Emu - Emu @@ -604,9 +601,6 @@ Crypto - - Emu - Emu diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index f0a50e9b3f..ac0bec64b9 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -86,21 +86,4 @@ CPUThread& GetCPU(const u8 core) return Emu.GetCPU().Get(core); }*/ -//TODOB: remove this -//convert a wxString to a std::string encoded in utf8 -//CAUTION, only use this to interface with wxWidgets classes -std::string fmt::ToUTF8(const wxString& right) -{ - auto ret = std::string(((const char *)right.utf8_str())); - return ret; -} - -//convert a std::string encoded in utf8 to a wxString -//CAUTION, only use this to interface with wxWidgets classes -wxString fmt::FromUTF8(const std::string& right) -{ - auto ret = wxString::FromUTF8(right.c_str()); - return ret; -} - GameInfo CurGameInfo; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index aaafa6aa15..d243fdc91a 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -73,7 +73,7 @@ false false $(ProjectName)-$(PlatformShortName) - + Level3 @@ -163,9 +163,9 @@ + - @@ -208,10 +208,10 @@ + - diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 23360f567c..a9707872ef 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -99,12 +99,12 @@ Gui - - Gui - Emu + + Emu + @@ -218,11 +218,11 @@ Gui - - Gui - Gui + + Emu + \ No newline at end of file diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 641cd68ca2..2a55bac8f1 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -291,17 +291,16 @@ enum Status #include "Utilities/IdManager.h" #include "Utilities/StrFmt.h" +#include "rpcs3/Ini.h" +#include "Gui/FrameBase.h" +#include "Gui/ConLogFrame.h" #include "Emu/ConLog.h" #include "Emu/DbgConsole.h" -#include "rpcs3/Ini.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/Callback.h" #include "Emu/DbgCommand.h" //#ifdef wxGUI -#include "Gui/FrameBase.h" -#include "Gui/DbgFrame.h" -#include "Gui/ConLogFrame.h" //#endif #include "Emu/Cell/PPUThread.h" #include "Emu/SysCalls/SC_FUNC.h" From 33d82e0d6e9525cb102ae688fa53521004205783 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Sun, 8 Jun 2014 23:23:36 +0200 Subject: [PATCH 5/5] reset debug output directory --- rpcs3/rpcs3.vcxproj.user | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rpcs3/rpcs3.vcxproj.user b/rpcs3/rpcs3.vcxproj.user index 02ce42b74d..b03467fb6a 100644 --- a/rpcs3/rpcs3.vcxproj.user +++ b/rpcs3/rpcs3.vcxproj.user @@ -1,15 +1,15 @@  - $(SolutionDir)..\rpcs3_bin\ + $(SolutionDir)bin\ WindowsLocalDebugger - $(SolutionDir)..\rpcs3_bin\ + $(SolutionDir)bin\ WindowsLocalDebugger - $(SolutionDir)..\rpcs3_bin\ + $(SolutionDir)bin\ WindowsLocalDebugger