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
This commit is contained in:
Peter Tissen 2014-05-02 08:30:32 +02:00
parent c4e3ec825e
commit c37905e465
156 changed files with 6567 additions and 4611 deletions

View file

@ -2,12 +2,24 @@
#include "Utilities/GNU.h" #include "Utilities/GNU.h"
#include <algorithm>
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<typename T, int size = sizeof(T)> struct se_t; template<typename T, int size = sizeof(T)> struct se_t;
template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } }; template<typename T> struct se_t<T, 1> { static __forceinline void func(T& dst, const T src) { (u8&)dst = (u8&)src; } };
template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } }; template<typename T> struct se_t<T, 2> { static __forceinline void func(T& dst, const T src) { (u16&)dst = _byteswap_ushort((u16&)src); } };
template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } }; template<typename T> struct se_t<T, 4> { static __forceinline void func(T& dst, const T src) { (u32&)dst = _byteswap_ulong((u32&)src); } };
template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } }; template<typename T> struct se_t<T, 8> { static __forceinline void func(T& dst, const T src) { (u64&)dst = _byteswap_uint64((u64&)src); } };
template<typename T> T re(const T val) { T res; se_t<T>::func(res, val); return res; }
template<typename T1, typename T2> void re(T1& dst, const T2 val) { se_t<T1>::func(dst, val); }
template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t; template<typename T, s64 _value, int size = sizeof(T)> struct const_se_t;
template<typename T, s64 _value> struct const_se_t<T, _value, 1> template<typename T, s64 _value> struct const_se_t<T, _value, 1>

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <unordered_map> #include <unordered_map>
#define rID_ANY -1 // was wxID_ANY
typedef u32 ID_TYPE; typedef u32 ID_TYPE;
class IDData class IDData
@ -154,7 +156,7 @@ public:
{ {
std::lock_guard<std::mutex> lock(m_mtx_main); std::lock_guard<std::mutex> lock(m_mtx_main);
if(id == wxID_ANY) if(id == rID_ANY)
return m_id_map.begin() != m_id_map.end(); return m_id_map.begin() != m_id_map.end();
} }

View file

@ -54,21 +54,23 @@ std::string replace_all(std::string src, const std::string& from, const std::str
return src; return src;
} }
//convert a wxString to a std::string encoded in utf8 //#ifdef wxGUI
//CAUTION, only use this to interface with wxWidgets classes ////convert a wxString to a std::string encoded in utf8
std::string fmt::ToUTF8(const wxString& right) ////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; // 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 ////convert a std::string encoded in utf8 to a wxString
wxString fmt::FromUTF8(const std::string& right) ////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; // auto ret = wxString::FromUTF8(right.c_str());
} // return ret;
//}
//#endif
//TODO: remove this after every snippet that uses it is gone //TODO: remove this after every snippet that uses it is gone
//WARNING: not fully compatible with CmpNoCase from wxString //WARNING: not fully compatible with CmpNoCase from wxString
@ -87,3 +89,45 @@ int fmt::CmpNoCase(const std::string& a, const std::string& b)
? 0 : -1; ? 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<std::string> fmt::rSplit(const std::string& source, const std::string& delim)
{
std::vector<std::string> 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;
}

View file

@ -9,6 +9,29 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #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{ namespace fmt{
using std::string; using std::string;
using std::ostream; using std::ostream;
@ -18,6 +41,38 @@ namespace fmt{
extern const string placeholder; extern const string placeholder;
template <typename T>
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 <typename T>
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 <typename T>
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 <typename T>
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 // 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 // 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 // `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 //WARNING: not fully compatible with CmpNoCase from wxString
int CmpNoCase(const std::string& a, const std::string& b); 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<std::string> rSplit(const std::string& source, const std::string& delim);
} }

View file

@ -124,9 +124,9 @@ public:
bool IsBusy() const { return m_busy; } 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.Post();
sem.Wait(); sem.Wait();

130
Utilities/rConcurrency.cpp Normal file
View file

@ -0,0 +1,130 @@
#include "stdafx.h"
rSemaphore::rSemaphore()
{
handle = reinterpret_cast<void*>(new wxSemaphore());
}
//rSemaphore::rSemaphore(rSemaphore& other)
//{
// handle = reinterpret_cast<void*>(new wxSemaphore(*reinterpret_cast<wxSemaphore*>(other.handle)));
//}
rSemaphore::~rSemaphore()
{
delete reinterpret_cast<wxSemaphore*>(handle);
}
rSemaphore::rSemaphore(int initial_count, int max_count)
{
handle = reinterpret_cast<void*>(new wxSemaphore(initial_count,max_count));
}
void rSemaphore::Wait()
{
reinterpret_cast<wxSemaphore*>(handle)->Wait();
}
rSemaStatus rSemaphore::TryWait()
{
wxSemaError err = reinterpret_cast<wxSemaphore*>(handle)->TryWait();
if (err == wxSEMA_BUSY)
{
return rSEMA_BUSY;
}
else
{
return rSEMA_OTHER;
}
}
void rSemaphore::Post()
{
reinterpret_cast<wxSemaphore*>(handle)->Post();
}
void rSemaphore::WaitTimeout(u64 timeout)
{
reinterpret_cast<wxSemaphore*>(handle)->WaitTimeout(timeout);
}
rCriticalSection::rCriticalSection()
{
handle = reinterpret_cast<void*>(new wxCriticalSection());
}
//rCriticalSection::rCriticalSection(rCriticalSection&)
//{
// handle = reinterpret_cast<void*>(new wxCriticalSection(*reinterpret_cast<wxCriticalSection*>(other.handle)));
//}
rCriticalSection::~rCriticalSection()
{
delete reinterpret_cast<wxCriticalSection*>(handle);
}
void rCriticalSection::Enter()
{
reinterpret_cast<wxCriticalSection*>(handle)->Enter();
}
void rCriticalSection::Leave()
{
reinterpret_cast<wxCriticalSection*>(handle)->Leave();
}
rTimer::rTimer()
{
handle = reinterpret_cast<void*>(new wxTimer());
}
//rTimer::rTimer(rTimer&)
//{
// handle = reinterpret_cast<void*>(new wxTimer(*reinterpret_cast<wxTimer*>(other.handle)));
//}
rTimer::~rTimer()
{
delete reinterpret_cast<wxTimer*>(handle);
}
void rTimer::Start()
{
reinterpret_cast<wxTimer*>(handle)->Start();
}
void rTimer::Stop()
{
reinterpret_cast<wxTimer*>(handle)->Stop();
}
void rSleep(u32 time)
{
wxSleep(time);
}
void rMicroSleep(u64 time)
{
wxMicroSleep(time);
}
rCriticalSectionLocker::rCriticalSectionLocker(const rCriticalSection &sec)
{
handle = reinterpret_cast<void*>(new wxCriticalSectionLocker(*reinterpret_cast<wxCriticalSection*>(sec.handle)));
}
rCriticalSectionLocker::~rCriticalSectionLocker()
{
delete reinterpret_cast<wxCriticalSectionLocker*>(handle);
}
bool rThread::IsMain()
{
return wxThread::IsMain();
}
void rYieldIfNeeded()
{
wxYieldIfNeeded();
}

59
Utilities/rConcurrency.h Normal file
View file

@ -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();

327
Utilities/rFile.cpp Normal file
View file

@ -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<void*>(new wxFile());
}
rFile::rFile(const std::string& filename, rFile::OpenMode open)
{
handle = reinterpret_cast<void*>(new wxFile(fmt::FromUTF8(filename), convertOpenMode(open)));
}
rFile::rFile(int fd)
{
handle = reinterpret_cast<void*>(new wxFile(fd));
}
rFile::~rFile()
{
delete reinterpret_cast<wxFile*>(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<wxFile*>(handle)->Write(buffer,count);
}
bool rFile::Write(const std::string &text)
{
return reinterpret_cast<wxFile*>(handle)->Write(fmt::FromUTF8(text));
}
bool rFile::Close()
{
return reinterpret_cast<wxFile*>(handle)->Close();
}
bool rFile::Create(const std::string &filename, bool overwrite, int access)
{
return reinterpret_cast<wxFile*>(handle)->Create(fmt::FromUTF8(filename),overwrite,access);
}
bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access)
{
return reinterpret_cast<wxFile*>(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<wxFile*>(handle)->IsOpened();
}
size_t rFile::Length() const
{
return reinterpret_cast<wxFile*>(handle)->Length();
}
size_t rFile::Read(void *buffer, size_t count)
{
return reinterpret_cast<wxFile*>(handle)->Read(buffer,count);
}
size_t rFile::Seek(size_t ofs, rSeekMode mode)
{
return reinterpret_cast<wxFile*>(handle)->Seek(ofs, convertSeekMode(mode));
}
size_t rFile::Tell() const
{
return reinterpret_cast<wxFile*>(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<void*>(new wxDir());
}
rDir::~rDir()
{
delete reinterpret_cast<wxDir*>(handle);
}
rDir::rDir(const std::string &path)
{
handle = reinterpret_cast<void*>(new wxDir(fmt::FromUTF8(path)));
}
bool rDir::Open(const std::string& path)
{
return reinterpret_cast<wxDir*>(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<wxDir*>(handle)->GetFirst(&str);
*filename = str.ToStdString();
return res;
}
bool rDir::GetNext(std::string *filename) const
{
wxString str;
bool res;
res = reinterpret_cast<wxDir*>(handle)->GetNext(&str);
*filename = str.ToStdString();
return res;
}
rFileName::rFileName()
{
handle = reinterpret_cast<void*>(new wxFileName());
}
rFileName::~rFileName()
{
delete reinterpret_cast<wxFileName*>(handle);
}
rFileName::rFileName(const rFileName& filename)
{
handle = reinterpret_cast<void*>(new wxFileName(*reinterpret_cast<wxFileName*>(filename.handle)));
}
rFileName::rFileName(const std::string& name)
{
handle = reinterpret_cast<void*>(new wxFileName(fmt::FromUTF8(name)));
}
std::string rFileName::GetFullPath()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetFullPath());
}
std::string rFileName::GetPath()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetPath());
}
std::string rFileName::GetName()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(handle)->GetName());
}
std::string rFileName::GetFullName()
{
return fmt::ToUTF8(reinterpret_cast<wxFileName*>(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<wxFileName*>(handle)->Normalize();
}

84
Utilities/rFile.h Normal file
View file

@ -0,0 +1,84 @@
#pragma once
#include <string>
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;
};

51
Utilities/rMsgBox.cpp Normal file
View file

@ -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<void*>(new wxMessageDialog(
reinterpret_cast<wxWindow*>(parent)
, fmt::FromUTF8(msg)
, fmt::FromUTF8(title)
, style
));
}
rMessageDialog::~rMessageDialog()
{
delete reinterpret_cast<wxMessageDialog*>(handle);
}
long rMessageDialog::ShowModal()
{
return reinterpret_cast<wxMessageDialog*>(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<wxApp*>(handle)->GetAppName());
}
else
{
return "NULL";
}
}
dummyApp::dummyApp() : handle(nullptr)
{
}
static dummyApp app;
dummyApp& rGetApp()
{
return app;
}

47
Utilities/rMsgBox.h Normal file
View file

@ -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();

165
Utilities/rPlatform.cpp Normal file
View file

@ -0,0 +1,165 @@
#include "stdafx.h"
#include <wx/glcanvas.h>
#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<void*>(new wxGLCanvas(static_cast<wxWindow *>(parent),wxID_ANY,NULL));
}
rCanvas::~rCanvas()
{
delete static_cast<wxGLCanvas*>(handle);
}
//void *rCanvas::GetCurrent()
//{
// static_cast<wxGLCanvas*>(handle)->GetCur;
//}
bool rCanvas::SetCurrent(void *ctx)
{
return static_cast<wxGLCanvas*>(handle)->SetCurrent(*static_cast<wxGLContext *>(ctx));
}
rGLFrame::rGLFrame()
{
handle = static_cast<void*>(new GLGSFrame());
}
rGLFrame::~rGLFrame()
{
delete static_cast<GLGSFrame*>(handle);
}
void rGLFrame::Close()
{
static_cast<GLGSFrame*>(handle)->Close();
}
bool rGLFrame::IsShown()
{
return static_cast<GLGSFrame*>(handle)->IsShown();
}
void rGLFrame::Hide()
{
static_cast<GLGSFrame*>(handle)->Hide();
}
void rGLFrame::Show()
{
static_cast<GLGSFrame*>(handle)->Show();
}
void *rGLFrame::GetNewContext()
{
return static_cast<void *>(new wxGLContext(
static_cast<GLGSFrame*>(handle)->GetCanvas()
));
}
void rGLFrame::Flip(void *ctx)
{
static_cast<GLGSFrame*>(handle)->Flip(
static_cast<wxGLContext*>(ctx));
}
void rGLFrame::SetCurrent(void *ctx)
{
static_cast<GLGSFrame*>(handle)->GetCanvas()->SetCurrent(*static_cast<wxGLContext*>(ctx));
}
rImage::rImage()
{
handle = static_cast<void*>(new wxImage());
}
rImage::~rImage()
{
delete static_cast<wxImage*>(handle);
}
void rImage::Create(int width, int height, void *data, void *alpha)
{
static_cast<wxImage*>(handle)->Create(width, height, static_cast<unsigned char*>(data), static_cast<unsigned char*>(alpha));
}
void rImage::SaveFile(const std::string& name, rImageType type)
{
if (type == rBITMAP_TYPE_PNG)
{
static_cast<wxImage*>(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();
}
}

114
Utilities/rPlatform.h Normal file
View file

@ -0,0 +1,114 @@
#pragma once
#include <vector>
#include <string>
//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<RSXDebuggerProgram> 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;
};

261
Utilities/rTime.cpp Normal file
View file

@ -0,0 +1,261 @@
#include "stdafx.h"
#include <wx/datetime.h>
std::string rDefaultDateTimeFormat = "%c";
rTimeSpan::rTimeSpan()
{
handle = static_cast<void *>(new wxTimeSpan());
}
rTimeSpan::~rTimeSpan()
{
delete static_cast<wxTimeSpan*>(handle);
}
rTimeSpan::rTimeSpan(const rTimeSpan& other)
{
handle = static_cast<void *>(new wxTimeSpan(*static_cast<wxTimeSpan*>(other.handle)));
}
rTimeSpan::rTimeSpan(int a, int b , int c, int d)
{
handle = static_cast<void *>(new wxTimeSpan(a,b,c,d));
}
rDateSpan::rDateSpan()
{
handle = static_cast<void *>(new wxDateSpan());
}
rDateSpan::~rDateSpan()
{
delete static_cast<wxDateSpan*>(handle);
}
rDateSpan::rDateSpan(const rDateSpan& other)
{
handle = static_cast<void *>(new wxDateSpan(*static_cast<wxDateSpan*>(other.handle)));
}
rDateSpan::rDateSpan(int a, int b, int c, int d)
{
handle = static_cast<void *>(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<void *>(new wxDateTime());
}
rDateTime::~rDateTime()
{
delete static_cast<wxDateTime*>(handle);
}
rDateTime::rDateTime(const rDateTime& other)
{
handle = static_cast<void *>(new wxDateTime(*static_cast<wxDateTime*>(other.handle)));
}
rDateTime::rDateTime(const time_t& time)
{
handle = static_cast<void *>(new wxDateTime(time));
}
rDateTime::rDateTime(u16 day, rDateTime::Month month, u16 year, u16 hour, u16 minute, u16 second, u32 millisecond)
{
handle = static_cast<void *>(new wxDateTime(day,(wxDateTime::Month)month,year,hour,minute,second,millisecond));
}
rDateTime rDateTime::UNow()
{
rDateTime time;
delete static_cast<wxDateTime*>(time.handle);
time.handle = static_cast<void *>(new wxDateTime(wxDateTime::UNow()));
return time;
}
rDateTime rDateTime::FromUTC(bool val)
{
rDateTime time(*this);
void *temp = time.handle;
time.handle = static_cast<void *>(new wxDateTime(static_cast<wxDateTime*>(temp)->FromTimezone(wxDateTime::GMT0, val)));
delete static_cast<wxDateTime*>(temp);
return time;
}
rDateTime rDateTime::ToUTC(bool val)
{
rDateTime time(*this);
void *temp = time.handle;
time.handle = static_cast<void *>(new wxDateTime(static_cast<wxDateTime*>(temp)->ToTimezone(wxDateTime::GMT0, val)));
delete static_cast<wxDateTime*>(temp);
return time;
}
time_t rDateTime::GetTicks()
{
return static_cast<wxDateTime*>(handle)->GetTicks();
}
void rDateTime::Add(const rTimeSpan& span)
{
static_cast<wxDateTime*>(handle)->Add(*static_cast<wxTimeSpan*>(span.handle));
}
void rDateTime::Add(const rDateSpan& span)
{
static_cast<wxDateTime*>(handle)->Add(*static_cast<wxDateSpan*>(span.handle));
}
//void rDateTime::Close()
//{
// static_cast<wxDateTime*>(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<wxDateTime*>(handle)->Format(fmt::FromUTF8(format),convertTZ(tz)));
}
void rDateTime::ParseDateTime(const std::string & format)
{
/*return fmt::ToUTF8(*/static_cast<wxDateTime*>(handle)->ParseDateTime(fmt::FromUTF8(format));
}
u32 rDateTime::GetAsDOS()
{
return static_cast<wxDateTime*>(handle)->GetAsDOS();
}
rDateTime &rDateTime::SetFromDOS(u32 fromdos)
{
static_cast<wxDateTime*>(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<wxDateTime::Month>(month), year, wxDateTime::Gregorian);
}
else
{
return wxDateTime::GetNumberOfDays(static_cast<wxDateTime::Month>(month), year, wxDateTime::Julian);
}
}
void rDateTime::SetToWeekDay(rDateTime::WeekDay day, int n, rDateTime::Month month, int year)
{
static_cast<wxDateTime*>(handle)->SetToWeekDay(
static_cast<wxDateTime::WeekDay>(day)
, n
, static_cast<wxDateTime::Month>(month)
, year
);
}
int rDateTime::GetWeekDay()
{
return static_cast<wxDateTime*>(handle)->GetWeekDay();
}
u16 rDateTime::GetYear(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetYear(convertTZ(timezone));
}
u16 rDateTime::GetMonth(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetMonth(convertTZ(timezone));
}
u16 rDateTime::GetDay(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetDay(convertTZ(timezone));
}
u16 rDateTime::GetHour(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetHour(convertTZ(timezone));
}
u16 rDateTime::GetMinute(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetMinute(convertTZ(timezone));
}
u16 rDateTime::GetSecond(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetSecond(convertTZ(timezone));
}
u32 rDateTime::GetMillisecond(rDateTime::TZ timezone)
{
return static_cast<wxDateTime*>(handle)->GetMillisecond(convertTZ(timezone));
}

102
Utilities/rTime.h Normal file
View file

@ -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;
};

101
Utilities/rXml.cpp Normal file
View file

@ -0,0 +1,101 @@
#include "stdafx.h"
#include <memory>
#include <wx/xml/xml.h>
rXmlNode::rXmlNode()
{
ownPtr = true;
handle = reinterpret_cast<void *>(new wxXmlNode());
}
rXmlNode::rXmlNode(void *ptr)
{
ownPtr = false;
handle = ptr;
}
rXmlNode::rXmlNode(const rXmlNode& other)
{
ownPtr = true;
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
}
rXmlNode &rXmlNode::operator=(const rXmlNode& other)
{
if (ownPtr)
{
delete reinterpret_cast<wxXmlNode*>(handle);
}
handle = reinterpret_cast<void *>(new wxXmlNode(*reinterpret_cast<wxXmlNode*>(other.handle)));
ownPtr = true;
return *this;
}
rXmlNode::~rXmlNode()
{
if (ownPtr)
{
delete reinterpret_cast<wxXmlNode*>(handle);
}
}
std::shared_ptr<rXmlNode> rXmlNode::GetChildren()
{
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetChildren();
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
}
std::shared_ptr<rXmlNode> rXmlNode::GetNext()
{
wxXmlNode* result = reinterpret_cast<wxXmlNode*>(handle)->GetNext();
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(result));
}
std::string rXmlNode::GetName()
{
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetName());
}
std::string rXmlNode::GetAttribute(const std::string &name)
{
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetAttribute(fmt::FromUTF8(name)));
}
std::string rXmlNode::GetNodeContent()
{
return fmt::ToUTF8(reinterpret_cast<wxXmlNode*>(handle)->GetNodeContent());
}
rXmlDocument::rXmlDocument()
{
handle = reinterpret_cast<void *>(new wxXmlDocument());
}
rXmlDocument::rXmlDocument(const rXmlDocument& other)
{
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
}
rXmlDocument &rXmlDocument::operator = (const rXmlDocument& other)
{
delete reinterpret_cast<wxXmlDocument*>(handle);
handle = reinterpret_cast<void *>(new wxXmlDocument(*reinterpret_cast<wxXmlDocument*>(other.handle)));
return *this;
}
rXmlDocument::~rXmlDocument()
{
delete reinterpret_cast<wxXmlDocument*>(handle);
}
void rXmlDocument::Load(const std::string & path)
{
reinterpret_cast<wxXmlDocument*>(handle)->Load(fmt::FromUTF8(path));
}
std::shared_ptr<rXmlNode> rXmlDocument::GetRoot()
{
return std::make_shared<rXmlNode>(reinterpret_cast<void*>(reinterpret_cast<wxXmlDocument*>(handle)->GetRoot()));
}

30
Utilities/rXml.h Normal file
View file

@ -0,0 +1,30 @@
#pragma once
struct rXmlNode
{
rXmlNode();
rXmlNode(void *);
rXmlNode(const rXmlNode& other);
rXmlNode &operator=(const rXmlNode& other);
~rXmlNode();
std::shared_ptr<rXmlNode> GetChildren();
std::shared_ptr<rXmlNode> 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<rXmlNode> GetRoot();
void *handle;
};

View file

@ -69,14 +69,14 @@
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset> <PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@ -151,6 +151,9 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
@ -166,6 +169,9 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
</Link> </Link>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
</Lib>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View file

@ -1,11 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 2013
VisualStudioVersion = 12.0.21005.1 VisualStudioVersion = 12.0.21005.1
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {CD478F02-7550-58A5-E085-CE4BC0C0AD23} {CD478F02-7550-58A5-E085-CE4BC0C0AD23} = {CD478F02-7550-58A5-E085-CE4BC0C0AD23}
{067D9406-2A93-DACA-9449-93A2D356357D} = {067D9406-2A93-DACA-9449-93A2D356357D} {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} {5C363C34-4741-7036-861C-2E2279CF552E} = {5C363C34-4741-7036-861C-2E2279CF552E}
{23E1C437-A951-5943-8639-A17F3CF2E606} = {23E1C437-A951-5943-8639-A17F3CF2E606} {23E1C437-A951-5943-8639-A17F3CF2E606} = {23E1C437-A951-5943-8639-A17F3CF2E606}
{22B14659-C5B6-B775-868D-A49198FEAD4A} = {22B14659-C5B6-B775-868D-A49198FEAD4A} {22B14659-C5B6-B775-868D-A49198FEAD4A} = {22B14659-C5B6-B775-868D-A49198FEAD4A}
@ -135,6 +138,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asmjit", "asmjitsrc\asmjit.
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asmjit", "asmjit", "{E2A982F2-4B1A-48B1-8D77-A17A589C58D7}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asmjit", "asmjit", "{E2A982F2-4B1A-48B1-8D77-A17A589C58D7}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "emucore", "rpcs3\emucore.vcxproj", "{C4A10229-4712-4BD2-B63E-50D93C67A038}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - MemLeak|x64 = Debug - MemLeak|x64 Debug - MemLeak|x64 = Debug - MemLeak|x64
@ -186,6 +191,7 @@ Global
{99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64 {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.ActiveCfg = Debug|x64
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Build.0 = 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.ActiveCfg = Debug|x64
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.Build.0 = Debug|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.Build.0 = Debug|x64
{6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|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.ActiveCfg = Release|x64
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Release|x64.Build.0 = 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 - MemLeak|x64.ActiveCfg = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Debug|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}.Debug|x64.Build.0 = Debug|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64 {AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.ActiveCfg = Release|x64
{AC40FF01-426E-4838-A317-66354CEFAE88}.Release|x64.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -11,6 +11,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif() endif()
add_definitions(-DwxGUI)
#add_definitions(-D__WXGTK__) #add_definitions(-D__WXGTK__)
#add_definitions(-Wfatal-errors) #add_definitions(-Wfatal-errors)
add_definitions(-w) # TODO: remove me add_definitions(-w) # TODO: remove me
@ -19,6 +20,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-g) # Debugging!! add_definitions(-g) # Debugging!!
add_definitions(-msse2) add_definitions(-msse2)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 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} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
endif() endif()

View file

@ -133,7 +133,7 @@ unsigned char* get_block_key(int block, NPD_HEADER *npd)
} }
// EDAT/SDAT functions. // 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. // Get metadata info and setup buffers.
int block_num = (int) ((edat->file_size + edat->block_size - 1) / edat->block_size); 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; 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); f->Seek(0);
unsigned char *header = new unsigned char[0xA0]; 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; 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. // Setup NPD and EDAT/SDAT structs.
NPD_HEADER *NPD = new NPD_HEADER(); 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) 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. // Prepare the files.
wxFile input(input_file_name.c_str()); rFile input(input_file_name.c_str());
wxFile output(output_file_name.c_str(), wxFile::write); rFile output(output_file_name.c_str(), rFile::write);
wxFile rap(rap_file_name.c_str()); rFile rap(rap_file_name.c_str());
// Set keys (RIF and DEVKLIC). // Set keys (RIF and DEVKLIC).
unsigned char rifkey[0x10]; unsigned char rifkey[0x10];
@ -682,7 +682,7 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi
{ {
input.Close(); input.Close();
output.Close(); output.Close();
wxRemoveFile(output_file_name); rRemoveFile(output_file_name);
return 0; return 0;
} }

View file

@ -5,7 +5,7 @@
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
// Decryption. // Decryption.
bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header) bool CheckHeader(rFile& pkg_f, PKGHeader* m_header)
{ {
if (m_header->pkg_magic != 0x7F504B47) { if (m_header->pkg_magic != 0x7F504B47) {
ConLog.Error("PKG: Not a package file!"); ConLog.Error("PKG: Not a package file!");
@ -48,7 +48,7 @@ bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header)
return true; return true;
} }
bool LoadHeader(wxFile& pkg_f, PKGHeader* m_header) bool LoadHeader(rFile& pkg_f, PKGHeader* m_header)
{ {
pkg_f.Seek(0); pkg_f.Seek(0);
@ -63,7 +63,7 @@ bool LoadHeader(wxFile& pkg_f, PKGHeader* m_header)
return true; 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)) if (!LoadHeader(pkg_f, m_header))
return -1; return -1;
@ -135,7 +135,7 @@ int Decrypt(wxFile& pkg_f, wxFile& dec_pkg_f, PKGHeader* m_header)
} }
// Unpacking. // 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.Seek(0);
dec_pkg_f.Read(m_entries, sizeof(PKGEntry) * m_header->file_count); 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; 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]; 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_SDAT:
case PKG_FILE_ENTRY_REGULAR: case PKG_FILE_ENTRY_REGULAR:
{ {
wxFile out; rFile out;
out.Create(dir + buf); out.Create(dir + std::string(reinterpret_cast<char *>(buf), entry.name_size));
dec_pkg_f.Seek(entry.file_offset); dec_pkg_f.Seek(entry.file_offset);
for (u64 size = 0; size < entry.file_size; ) { 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; break;
case PKG_FILE_ENTRY_FOLDER: case PKG_FILE_ENTRY_FOLDER:
wxMkdir(dir + buf); rMkdir(dir + std::string(reinterpret_cast<char *>(buf), entry.name_size));
break; break;
} }
return true; 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)); PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader));
wxFile dec_pkg_f; rFile dec_pkg_f;
std::string decryptedFile = wxGetCwd().ToStdString() + "/dev_hdd1/" + src + ".dec"; std::string decryptedFile = rGetCwd() + "/dev_hdd1/" + src + ".dec";
dec_pkg_f.Create(decryptedFile, true); 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(); dec_pkg_f.Close();
wxFile n_dec_pkg_f(decryptedFile, wxFile::read); rFile n_dec_pkg_f(decryptedFile, rFile::read);
std::vector<PKGEntry> m_entries; std::vector<PKGEntry> m_entries;
m_entries.resize(m_header->file_count); m_entries.resize(m_header->file_count);

View file

@ -47,4 +47,4 @@ struct PKGEntry
be_t<u32> pad; // Padding (zeros) be_t<u32> pad; // Padding (zeros)
}; };
extern int Unpack(wxFile& dec_pkg_f, std::string src, std::string dst); extern int Unpack(rFile& dec_pkg_f, std::string src, std::string dst);

View file

@ -389,7 +389,7 @@ bool SELFDecrypter::DecryptData()
bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32) bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32)
{ {
// Create a new ELF file. // Create a new ELF file.
wxFile e(elf.c_str(), wxFile::write); rFile e(elf.c_str(), rFile::write);
if(!e.IsOpened()) if(!e.IsOpened())
{ {
ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); 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. // Try to find a matching RAP file under dev_usb000.
std::string ci_str((const char *)content_id); 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. // 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!"); ConLog.Error("This application requires a valid RAP file for decryption!");
return false; return false;
} }
// Open the RAP file and read the key. // 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()) if (!rap_file.IsOpened())
{ {
@ -569,7 +569,7 @@ bool IsSelfElf32(const std::string& path)
bool CheckDebugSelf(const std::string& self, const std::string& elf) bool CheckDebugSelf(const std::string& self, const std::string& elf)
{ {
// Open the SELF file. // Open the SELF file.
wxFile s(fmt::FromUTF8(self)); rFile s(self);
if(!s.IsOpened()) if(!s.IsOpened())
{ {
@ -597,7 +597,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf)
s.Seek(elf_offset); s.Seek(elf_offset);
// Write the real ELF file back. // Write the real ELF file back.
wxFile e(fmt::FromUTF8(elf), wxFile::write); rFile e(elf, rFile::write);
if(!e.IsOpened()) if(!e.IsOpened())
{ {
ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); ConLog.Error("Could not create ELF file! (%s)", elf.c_str());

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "Emu/ARMv7/ARMv7Opcodes.h" #include "Emu/ARMv7/ARMv7Opcodes.h"
#include "Emu/CPU/CPUDisAsm.h" #include "Emu/CPU/CPUDisAsm.h"
#include "Gui/DisAsmFrame.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
static const char* g_arm_cond_name[16] = static const char* g_arm_cond_name[16] =

View file

@ -11,7 +11,7 @@ AudioDumper::~AudioDumper()
bool AudioDumper::Init() bool AudioDumper::Init()
{ {
return m_output.Open("audio.wav", wxFile::write); return m_output.Open("audio.wav", rFile::write);
} }
void AudioDumper::WriteHeader() void AudioDumper::WriteHeader()

View file

@ -55,7 +55,7 @@ class AudioDumper
{ {
private: private:
WAVHeader m_header; WAVHeader m_header;
wxFile m_output; rFile m_output;
public: public:
AudioDumper(u8 ch); AudioDumper(u8 ch);

View file

@ -4,7 +4,6 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "rpcs3/Ini.h" #include "rpcs3/Ini.h"
#include "rpcs3.h"
#include "CPUThread.h" #include "CPUThread.h"
@ -86,13 +85,13 @@ void CPUThread::SetName(const std::string& name)
void CPUThread::Wait(bool wait) void CPUThread::Wait(bool wait)
{ {
wxCriticalSectionLocker lock(m_cs_sync); rCriticalSectionLocker lock(m_cs_sync);
m_sync_wait = wait; m_sync_wait = wait;
} }
void CPUThread::Wait(const CPUThread& thr) void CPUThread::Wait(const CPUThread& thr)
{ {
wxCriticalSectionLocker lock(m_cs_sync); rCriticalSectionLocker lock(m_cs_sync);
m_wait_thread_id = thr.GetId(); m_wait_thread_id = thr.GetId();
m_sync_wait = true; m_sync_wait = true;
} }
@ -178,13 +177,13 @@ void CPUThread::SetError(const u32 error)
} }
} }
wxArrayString CPUThread::ErrorToString(const u32 error) std::vector<std::string> CPUThread::ErrorToString(const u32 error)
{ {
wxArrayString earr; std::vector<std::string> earr;
if(error == 0) return earr; if(error == 0) return earr;
earr.Add("Unknown error"); earr.push_back("Unknown error");
return earr; return earr;
} }
@ -196,9 +195,7 @@ void CPUThread::Run()
Reset(); Reset();
#ifndef QT_UI SendDbgCommand(DID_START_THREAD, this);
wxGetApp().SendDbgCommand(DID_START_THREAD, this);
#endif
m_status = Running; m_status = Running;
@ -208,18 +205,14 @@ void CPUThread::Run()
DoRun(); DoRun();
Emu.CheckStatus(); Emu.CheckStatus();
#ifndef QT_UI SendDbgCommand(DID_STARTED_THREAD, this);
wxGetApp().SendDbgCommand(DID_STARTED_THREAD, this);
#endif
} }
void CPUThread::Resume() void CPUThread::Resume()
{ {
if(!IsPaused()) return; if(!IsPaused()) return;
#ifndef QT_UI SendDbgCommand(DID_RESUME_THREAD, this);
wxGetApp().SendDbgCommand(DID_RESUME_THREAD, this);
#endif
m_status = Running; m_status = Running;
DoResume(); DoResume();
@ -227,36 +220,28 @@ void CPUThread::Resume()
ThreadBase::Start(); ThreadBase::Start();
#ifndef QT_UI SendDbgCommand(DID_RESUMED_THREAD, this);
wxGetApp().SendDbgCommand(DID_RESUMED_THREAD, this);
#endif
} }
void CPUThread::Pause() void CPUThread::Pause()
{ {
if(!IsRunning()) return; if(!IsRunning()) return;
#ifndef QT_UI SendDbgCommand(DID_PAUSE_THREAD, this);
wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this);
#endif
m_status = Paused; m_status = Paused;
DoPause(); DoPause();
Emu.CheckStatus(); Emu.CheckStatus();
// ThreadBase::Stop(); // "Abort() called" exception // ThreadBase::Stop(); // "Abort() called" exception
#ifndef QT_UI SendDbgCommand(DID_PAUSED_THREAD, this);
wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this);
#endif
} }
void CPUThread::Stop() void CPUThread::Stop()
{ {
if(IsStopped()) return; if(IsStopped()) return;
#ifndef QT_UI SendDbgCommand(DID_STOP_THREAD, this);
wxGetApp().SendDbgCommand(DID_STOP_THREAD, this);
#endif
m_status = Stopped; m_status = Stopped;
@ -270,17 +255,13 @@ void CPUThread::Stop()
Emu.CheckStatus(); Emu.CheckStatus();
#ifndef QT_UI SendDbgCommand(DID_STOPED_THREAD, this);
wxGetApp().SendDbgCommand(DID_STOPED_THREAD, this);
#endif
} }
void CPUThread::Exec() void CPUThread::Exec()
{ {
m_is_step = false; m_is_step = false;
#ifndef QT_UI SendDbgCommand(DID_EXEC_THREAD, this);
wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this);
#endif
if(IsRunning()) if(IsRunning())
ThreadBase::Start(); ThreadBase::Start();
@ -289,17 +270,14 @@ void CPUThread::Exec()
void CPUThread::ExecOnce() void CPUThread::ExecOnce()
{ {
m_is_step = true; m_is_step = true;
#ifndef QT_UI SendDbgCommand(DID_EXEC_THREAD, this);
wxGetApp().SendDbgCommand(DID_EXEC_THREAD, this);
#endif
m_status = Running; m_status = Running;
ThreadBase::Start(); ThreadBase::Start();
ThreadBase::Stop(true,false); ThreadBase::Stop(true,false);
m_status = Paused; m_status = Paused;
#ifndef QT_UI SendDbgCommand(DID_PAUSE_THREAD, this);
wxGetApp().SendDbgCommand(DID_PAUSE_THREAD, this); SendDbgCommand(DID_PAUSED_THREAD, this);
wxGetApp().SendDbgCommand(DID_PAUSED_THREAD, this);
#endif
} }
void CPUThread::Task() void CPUThread::Task()

View file

@ -133,7 +133,7 @@ public:
u32 m_wait_thread_id; u32 m_wait_thread_id;
wxCriticalSection m_cs_sync; rCriticalSection m_cs_sync;
bool m_sync_wait; bool m_sync_wait;
void Wait(bool wait); void Wait(bool wait);
void Wait(const CPUThread& thr); void Wait(const CPUThread& thr);
@ -157,8 +157,8 @@ public:
void SetError(const u32 error); void SetError(const u32 error);
static wxArrayString ErrorToString(const u32 error); static std::vector<std::string> ErrorToString(const u32 error);
wxArrayString ErrorToString() { return ErrorToString(m_error); } std::vector<std::string> ErrorToString() { return ErrorToString(m_error); }
bool IsOk() const { return m_error == 0; } bool IsOk() const { return m_error == 0; }
bool IsRunning() const { return m_status == Running; } bool IsRunning() const { return m_status == Running; }

View file

@ -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)); new_thread->SetId(Emu.GetIdManager().GetNewID(fmt::Format("%s Thread", new_thread->GetTypeString().c_str()), new_thread));
m_threads.push_back(new_thread); m_threads.push_back(new_thread);
#ifndef QT_UI SendDbgCommand(DID_CREATE_THREAD, new_thread);
wxGetApp().SendDbgCommand(DID_CREATE_THREAD, new_thread);
#endif
return *new_thread; return *new_thread;
} }
@ -73,9 +71,7 @@ void CPUThreadManager::RemoveThread(const u32 id)
if (thr) if (thr)
{ {
#ifndef QT_UI SendDbgCommand(DID_REMOVE_THREAD, thr);
wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr);
#endif
thr->Close(); thr->Close();
m_threads.erase(m_threads.begin() + thread_index); m_threads.erase(m_threads.begin() + thread_index);

View file

@ -6,7 +6,7 @@ class CPUThreadManager
{ {
std::vector<CPUThread*> m_threads; std::vector<CPUThread*> m_threads;
std::mutex m_mtx_thread; std::mutex m_mtx_thread;
wxSemaphore m_sem_task; rSemaphore m_sem_task;
u32 m_raw_spu_num; u32 m_raw_spu_num;
public: public:

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "Emu/CPU/CPUDisAsm.h" #include "Emu/CPU/CPUDisAsm.h"
#include "Gui/DisAsmFrame.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
class PPCDisAsm : public CPUDisAsm class PPCDisAsm : public CPUDisAsm

View file

@ -3,7 +3,6 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "PPCThread.h" #include "PPCThread.h"
#include "Gui/InterpreterDisAsm.h"
PPCThread* GetCurrentPPCThread() PPCThread* GetCurrentPPCThread()
{ {

View file

@ -3,7 +3,6 @@
#include "Emu/Cell/PPUOpcodes.h" #include "Emu/Cell/PPUOpcodes.h"
#include "Emu/Cell/PPCDisAsm.h" #include "Emu/Cell/PPCDisAsm.h"
#include "Emu/Cell/PPCThread.h" #include "Emu/Cell/PPCThread.h"
#include "Gui/DisAsmFrame.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
class PPUDisAsm class PPUDisAsm

View file

@ -4,7 +4,7 @@
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/Cell/PPUThread.h" #include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
#include "rpcs3.h" //#include "rpcs3.h" //GUI dependency
#include <stdint.h> #include <stdint.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <intrin.h> #include <intrin.h>
@ -2095,11 +2095,11 @@ private:
case 0x1: UNK(fmt::Format("HyperCall %d", CPU.GPR[0])); break; case 0x1: UNK(fmt::Format("HyperCall %d", CPU.GPR[0])); break;
case 0x2: SysCall(); break; case 0x2: SysCall(); break;
case 0x3: case 0x3:
StaticExecute(CPU.GPR[11]); Emu.GetSFuncManager().StaticExecute(CPU.GPR[11]);
if (Ini.HLELogging.GetValue()) if (Ini.HLELogging.GetValue())
{ {
ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx", 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; break;
case 0x22: UNK("HyperCall LV1"); break; case 0x22: UNK("HyperCall LV1"); break;

View file

@ -1495,7 +1495,7 @@ void CompilePPUProgram::Compile()
s_shstrtab.sh_size = section_name_offset; s_shstrtab.sh_size = section_name_offset;
section_offset += s_shstrtab.sh_size; 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_magic = 0x7F454C46;
elf_info.e_class = 2; //ELF64 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_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); f.Seek(s_lib_stub.sh_offset);
for(u32 i=0, nameoffs=4, dataoffs=0; i<modules.size(); ++i) for(u32 i=0, nameoffs=4, dataoffs=0; i<modules.size(); ++i)
@ -1608,7 +1608,7 @@ void CompilePPUProgram::Compile()
} }
f.Seek(s_lib_stub_btm.sh_offset); f.Seek(s_lib_stub_btm.sh_offset);
f.Seek(s_lib_stub_btm.sh_size, wxFromCurrent); f.Seek(s_lib_stub_btm.sh_size, rFromCurrent);
f.Seek(s_data_sceFStub.sh_offset); f.Seek(s_data_sceFStub.sh_offset);
for(const Module& module : modules) for(const Module& module : modules)
@ -1638,13 +1638,13 @@ void CompilePPUProgram::Compile()
f.Write(&prx_param, sizeof(sys_proc_prx_param)); f.Write(&prx_param, sizeof(sys_proc_prx_param));
f.Seek(s_lib_ent_top.sh_offset); f.Seek(s_lib_ent_top.sh_offset);
f.Seek(s_lib_ent_top.sh_size, wxFromCurrent); f.Seek(s_lib_ent_top.sh_size, rFromCurrent);
f.Seek(s_lib_ent_btm.sh_offset); f.Seek(s_lib_ent_btm.sh_offset);
f.Seek(s_lib_ent_btm.sh_size, wxFromCurrent); f.Seek(s_lib_ent_btm.sh_size, rFromCurrent);
f.Seek(s_tbss.sh_offset); f.Seek(s_tbss.sh_offset);
f.Seek(s_tbss.sh_size, wxFromCurrent); f.Seek(s_tbss.sh_size, rFromCurrent);
f.Seek(s_shstrtab.sh_offset + 1); f.Seek(s_shstrtab.sh_offset + 1);
for(u32 i=0; i<sections_names.size(); ++i) for(u32 i=0; i<sections_names.size(); ++i)

View file

@ -191,7 +191,7 @@ bool FPRdouble::IsINF(PPCdouble d)
bool FPRdouble::IsNaN(PPCdouble d) bool FPRdouble::IsNaN(PPCdouble d)
{ {
return wxIsNaN(d) ? 1 : 0; return isnan(d) ? 1 : 0;
} }
bool FPRdouble::IsQNaN(PPCdouble d) bool FPRdouble::IsQNaN(PPCdouble d)

View file

@ -2,7 +2,7 @@
#define PPUTHREAD_H #define PPUTHREAD_H
#include "Emu/Cell/PPCThread.h" #include "Emu/Cell/PPCThread.h"
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
#include "rpcs3.h" //#include "rpcs3.h" //GUI dependency
#include <cmath> #include <cmath>
enum enum

View file

@ -3,7 +3,6 @@
#include "Emu/Cell/SPUOpcodes.h" #include "Emu/Cell/SPUOpcodes.h"
#include "Emu/Cell/PPCDisAsm.h" #include "Emu/Cell/PPCDisAsm.h"
#include "Emu/Cell/SPUThread.h" #include "Emu/Cell/SPUThread.h"
#include "Gui/DisAsmFrame.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
class SPUDisAsm class SPUDisAsm

View file

@ -142,11 +142,11 @@ void SPURecompilerCore::Compile(u16 pos)
entry[start].pointer = compiler.make(); entry[start].pointer = compiler.make();
compiler.setLogger(nullptr); // crashes without it compiler.setLogger(nullptr); // crashes without it
wxFile log; rFile log;
log.Open(wxString::Format("SPUjit_%d.log", GetCurrentSPUThread().GetId()), first ? wxFile::write : wxFile::write_append); log.Open(fmt::Format("SPUjit_%d.log", GetCurrentSPUThread().GetId()), first ? rFile::write : rFile::write_append);
log.Write(wxString::Format("========== START POSITION 0x%x ==========\n\n", start * 4)); log.Write(fmt::Format("========== START POSITION 0x%x ==========\n\n", start * 4));
log.Write(wxString(stringLogger.getString())); log.Write(std::string(stringLogger.getString()));
log.Write(wxString::Format("========== COMPILED %d (excess %d), time: [start=%lld (decoding=%lld), finalize=%lld]\n\n", 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)); entry[start].count, excess, stamp1 - stamp0, time0, get_system_time() - stamp1));
log.Close(); log.Close();
m_enc->compiler = nullptr; m_enc->compiler = nullptr;

View file

@ -1,15 +1,8 @@
#pragma once #pragma once
#include <wx/listctrl.h>
#include "Ini.h"
#include "Gui/FrameBase.h"
class LogWriter class LogWriter
{ {
wxFile m_logfile; rFile m_logfile;
wxColour m_txtcolour;
//wxString m_prefix;
//wxString m_value;
void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl); void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl);
@ -47,4 +40,5 @@ public:
virtual void SkipLn(); virtual void SkipLn();
}; };
extern LogWriter ConLog; extern LogWriter ConLog;

6
rpcs3/Emu/DbgCommand.cpp Normal file
View file

@ -0,0 +1,6 @@
#include "stdafx.h"
void SendDbgCommand(DbgCommand id, CPUThread* thr )
{
wxGetApp().SendDbgCommand(id, thr);
}

40
rpcs3/Emu/DbgCommand.h Normal file
View file

@ -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);

View file

@ -4,94 +4,91 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "DbgConsole.h" #include "DbgConsole.h"
BEGIN_EVENT_TABLE(DbgConsole, FrameBase) LogWriter ConLog;
EVT_CLOSE(DbgConsole::OnQuit) class LogFrame;
END_EVENT_TABLE() extern LogFrame* ConLogFrame;
DbgConsole::DbgConsole() _LogBuffer LogBuffer;
: FrameBase(nullptr, wxID_ANY, "Debug Console", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true)
, ThreadBase("DbgConsole thread") std::mutex g_cs_conlog;
, m_output(nullptr)
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, "Black", "Green", "White", "Yellow", "Red",
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)); LogWriter::LogWriter()
m_color_red = new wxTextAttr(wxColour(255, 0, 0)); {
if (!m_logfile.Open(_PRGNAME_ ".log", rFile::write))
if (Ini.HLESaveTTY.GetValue()) {
m_output = new wxFile("tty.log", wxFile::write); rMessageBox("Can't create log file! (" _PRGNAME_ ".log)", rMessageBoxCaptionStr, rICON_ERROR);
}
} }
DbgConsole::~DbgConsole() void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/)
{ {
ThreadBase::Stop(); std::string new_prefix = prefix;
m_dbg_buffer.Flush(); if (!prefix.empty())
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 (Emu.IsStopped()) 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; return;
}
Sleep(1);
}
m_dbg_buffer.Push(DbgPacket(ch, text));
if(!IsAlive()) Start(); std::lock_guard<std::mutex> lock(g_cs_conlog);
}
void DbgConsole::Clear() // TODO: Use ThreadBase instead, track main thread id
{ if (rThread::IsMain())
m_console->Clear();
}
void DbgConsole::Task()
{
while(!TestDestroy())
{ {
if(!m_dbg_buffer.HasNewPacket()) while (LogBuffer.IsBusy())
{
// need extra break condition?
rYieldIfNeeded();
}
}
else
{
while (LogBuffer.IsBusy())
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
break; break;
} }
Sleep(1); Sleep(1);
continue; }
} }
DbgPacket packet = m_dbg_buffer.Pop(); //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush();
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()) LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl]));
m_output->Write(fmt::FromUTF8(packet.m_text));
if(!DbgConsole::IsShown()) Show();
}
} }
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();
} }

View file

@ -1,5 +1,10 @@
#pragma once #pragma once
#include <cstring> //for memset
extern const uint max_item_count;
extern const uint buffer_size;
struct DbgPacket struct DbgPacket
{ {
int m_ch; 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<LogPacket>
{
_LogBuffer() : MTPacketBuffer<LogPacket>(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<DbgPacket> struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
{ {
_DbgBuffer() : MTPacketBuffer<DbgPacket>(1024) _DbgBuffer() : MTPacketBuffer<DbgPacket>(1024)
@ -68,24 +154,10 @@ struct _DbgBuffer : public MTPacketBuffer<DbgPacket>
} }
}; };
class DbgConsole struct DbgConsole
: public FrameBase
, public ThreadBase
{ {
wxFile* m_output; int i;
wxTextCtrl* m_console; void Close();
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 Clear();
virtual void Task(); void Write(int ch, const std::string &msg);
private:
void OnQuit(wxCloseEvent& event);
DECLARE_EVENT_TABLE();
}; };

View file

@ -243,9 +243,9 @@ vfsDevice* VFS::GetDeviceLocal(const std::string& local_path, std::string& path)
u32 max_eq; u32 max_eq;
s32 max_i=-1; s32 max_i=-1;
wxFileName file_path(fmt::FromUTF8(local_path)); rFileName file_path(local_path);
file_path.Normalize(); file_path.Normalize();
std::string mormalized_path = fmt::ToUTF8(file_path.GetFullPath()); std::string mormalized_path = file_path.GetFullPath();
for(u32 i=0; i<m_devices.size(); ++i) for(u32 i=0; i<m_devices.size(); ++i)
{ {
@ -289,10 +289,10 @@ void VFS::Init(const std::string& path)
continue; continue;
} }
wxString mpath = entry.path; std::string mpath = entry.path;
mpath.Replace("$(EmulatorDir)", wxGetCwd()); fmt::Replace(mpath,"$(EmulatorDir)", rGetCwd());
mpath.Replace("$(GameDir)", fmt::FromUTF8(vfsDevice::GetRoot(path))); fmt::Replace(mpath,"$(GameDir)", vfsDevice::GetRoot(path));
Mount(entry.mount, fmt::ToUTF8(mpath), dev); Mount(entry.mount, mpath, dev);
} }
} }

View file

@ -46,24 +46,24 @@ u32 vfsDevice::CmpLocalPath(const std::string& local_path)
if(local_path.length() < m_local_path.length()) if(local_path.length() < m_local_path.length())
return 0; return 0;
wxFileName path0(fmt::FromUTF8(m_local_path)); rFileName path0(m_local_path);
path0.Normalize(); path0.Normalize();
#ifdef _WIN32 #ifdef _WIN32
#define DL '\\' #define DL "\\"
#else #else
#define DL '/' #define DL "/"
#endif #endif
wxArrayString arr0 = wxSplit(path0.GetFullPath(), DL); std::vector<std::string> arr0 = fmt::rSplit(path0.GetFullPath(), DL);
wxArrayString arr1 = wxSplit(fmt::FromUTF8(local_path), DL); std::vector<std::string> 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; u32 ret = 0;
for(u32 i=0; i<lim; ret += arr0[i++].Len() + 1) for(u32 i=0; i<lim; ret += arr0[i++].size() + 1)
{ {
if(arr0[i].CmpNoCase(arr1[i]) != 0) if(fmt::CmpNoCase(arr0[i],arr1[i]) != 0)
{ {
break; break;
} }
@ -188,9 +188,9 @@ std::string vfsDevice::GetWinPath(const std::string& p, bool is_dir)
if(is_dir && ret[ret.length() - 1] != '/' && ret[ret.length() - 1] != '\\') ret += '/'; // ??? if(is_dir && ret[ret.length() - 1] != '/' && ret[ret.length() - 1] != '\\') ret += '/'; // ???
wxFileName res(fmt::FromUTF8(ret)); rFileName res(ret);
res.Normalize(); res.Normalize();
return fmt::ToUTF8(res.GetFullPath()); return res.GetFullPath();
} }
std::string vfsDevice::GetWinPath(const std::string& l, const std::string& r) std::string vfsDevice::GetWinPath(const std::string& l, const std::string& r)

View file

@ -32,7 +32,7 @@ bool vfsDirBase::IsOpened() const
bool vfsDirBase::IsExists(const std::string& path) const bool vfsDirBase::IsExists(const std::string& path) const
{ {
return wxDirExists(fmt::FromUTF8(path)); return rDirExists(path);
} }
const std::vector<DirEntryInfo>& vfsDirBase::GetEntries() const const std::vector<DirEntryInfo>& vfsDirBase::GetEntries() const

View file

@ -15,24 +15,24 @@ bool vfsLocalDir::Open(const std::string& path)
if(!vfsDirBase::Open(path)) if(!vfsDirBase::Open(path))
return false; return false;
wxDir dir; rDir dir;
if(!dir.Open(path)) if(!dir.Open(path))
return false; return false;
wxString name; std::string name;
for(bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&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(); m_entries.emplace_back();
DirEntryInfo& info = m_entries.back(); DirEntryInfo& info = m_entries.back();
info.name = fmt::ToUTF8(name); info.name = name;
info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile; info.flags |= dir.Exists(dir_path) ? DirEntry_TypeDir : DirEntry_TypeFile;
if(wxIsWritable(dir_path)) info.flags |= DirEntry_PermWritable; if(rIsWritable(dir_path)) info.flags |= DirEntry_PermWritable;
if(wxIsReadable(dir_path)) info.flags |= DirEntry_PermReadable; if(rIsReadable(dir_path)) info.flags |= DirEntry_PermReadable;
if(wxIsExecutable(dir_path)) info.flags |= DirEntry_PermExecutable; if(rIsExecutable(dir_path)) info.flags |= DirEntry_PermExecutable;
} }
return true; return true;
@ -40,7 +40,7 @@ bool vfsLocalDir::Open(const std::string& path)
bool vfsLocalDir::Create(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) 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) bool vfsLocalDir::Remove(const std::string& path)
{ {
return wxRmdir(fmt::FromUTF8(path)); return rRmdir(path);
} }

View file

@ -2,30 +2,30 @@
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
#include "vfsLocalFile.h" #include "vfsLocalFile.h"
static const wxFile::OpenMode vfs2wx_mode(vfsOpenMode mode) static const rFile::OpenMode vfs2wx_mode(vfsOpenMode mode)
{ {
switch(mode) switch(mode)
{ {
case vfsRead: return wxFile::read; case vfsRead: return rFile::read;
case vfsWrite: return wxFile::write; case vfsWrite: return rFile::write;
case vfsReadWrite: return wxFile::read_write; case vfsReadWrite: return rFile::read_write;
case vfsWriteExcl: return wxFile::write_excl; case vfsWriteExcl: return rFile::write_excl;
case vfsWriteAppend: return wxFile::write_append; 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) switch(mode)
{ {
case vfsSeekSet: return wxFromStart; case vfsSeekSet: return rFromStart;
case vfsSeekCur: return wxFromCurrent; case vfsSeekCur: return rFromCurrent;
case vfsSeekEnd: return wxFromEnd; case vfsSeekEnd: return rFromEnd;
} }
return wxFromStart; return rFromStart;
} }
vfsLocalFile::vfsLocalFile(vfsDevice* device) : vfsFileBase(device) vfsLocalFile::vfsLocalFile(vfsDevice* device) : vfsFileBase(device)
@ -45,9 +45,9 @@ bool vfsLocalFile::Open(const std::string& path, vfsOpenMode mode)
// } // }
// else // 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; break;
const std::string& dir = path.substr(0, p); const std::string& dir = path.substr(0, p);
if(!wxDirExists(fmt::FromUTF8(dir))) if(!rDirExists(dir))
{ {
ConLog.Write("create dir: %s", dir.c_str()); ConLog.Write("create dir: %s", dir.c_str());
wxMkdir(fmt::FromUTF8(dir)); rMkdir(dir);
} }
} }
//create file //create file
const char m = path[path.length() - 1]; const char m = path[path.length() - 1];
if(m != '/' && m != '\\' && !wxFileExists(fmt::FromUTF8(path))) // ??? if(m != '/' && m != '\\' && !rFileExists(path)) // ???
{ {
wxFile f; rFile f;
return f.Create(fmt::FromUTF8(path)); return f.Create(path);
} }
return true; return true;

View file

@ -4,7 +4,7 @@
class vfsLocalFile : public vfsFileBase class vfsLocalFile : public vfsFileBase
{ {
private: private:
wxFile m_file; rFile m_file;
public: public:
vfsLocalFile(vfsDevice* device); vfsLocalFile(vfsDevice* device);

View file

@ -1269,7 +1269,7 @@ static const std::string GetMethodName(const u32 id)
{ NV4097_SET_TRANSFORM_BRANCH_BITS, "SetTransformBranchBits" } , { 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; if(METHOD_NAME_LIST[i].id == id) return "cellGcm" + METHOD_NAME_LIST[i].name;
} }

View file

@ -4,7 +4,6 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "GLGSRender.h" #include "GLGSRender.h"
#include "Emu/Cell/PPCInstrTable.h" #include "Emu/Cell/PPCInstrTable.h"
#include "Gui/RSXDebugger.h"
#define CMD_DEBUG 0 #define CMD_DEBUG 0
#define DUMP_VERTEX_DATA 0 #define DUMP_VERTEX_DATA 0
@ -39,53 +38,6 @@ void printGlError(GLenum err, const std::string& situation)
#define checkForGlError(x) /*x*/ #define checkForGlError(x) /*x*/
#endif #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() GLGSRender::GLGSRender()
: GSRender() : GSRender()
@ -94,7 +46,7 @@ GLGSRender::GLGSRender()
, m_vp_buf_num(-1) , m_vp_buf_num(-1)
, m_context(nullptr) , m_context(nullptr)
{ {
m_frame = new GLGSFrame(); m_frame = new rGLFrame();// new GLGSFrame();
} }
GLGSRender::~GLGSRender() GLGSRender::~GLGSRender()
@ -164,7 +116,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw)
checkForGlError("initializing vbo"); checkForGlError("initializing vbo");
#if DUMP_VERTEX_DATA #if DUMP_VERTEX_DATA
wxFile dump("VertexDataArray.dump", wxFile::write); rFile dump("VertexDataArray.dump", rFile::write);
#endif #endif
for(u32 i=0; i<m_vertex_count; ++i) for(u32 i=0; i<m_vertex_count; ++i)
@ -406,7 +358,7 @@ bool GLGSRender::LoadProgram()
m_shader_prog.Compile(); m_shader_prog.Compile();
checkForGlError("m_shader_prog.Compile"); checkForGlError("m_shader_prog.Compile");
wxFile f(wxGetCwd() + "/FragmentProgram.txt", wxFile::write); rFile f(rGetCwd() + "/FragmentProgram.txt", rFile::write);
f.Write(m_shader_prog.GetShaderText()); f.Write(m_shader_prog.GetShaderText());
} }
@ -418,7 +370,7 @@ bool GLGSRender::LoadProgram()
m_vertex_prog.Compile(); m_vertex_prog.Compile();
checkForGlError("m_vertex_prog.Compile"); checkForGlError("m_vertex_prog.Compile");
wxFile f(wxGetCwd() + "/VertexProgram.txt", wxFile::write); rFile f(rGetCwd() + "/VertexProgram.txt", rFile::write);
f.Write(m_vertex_prog.shader); f.Write(m_vertex_prog.shader);
} }
@ -656,9 +608,11 @@ void GLGSRender::OnInit()
void GLGSRender::OnInitThread() void GLGSRender::OnInitThread()
{ {
m_context = new wxGLContext(m_frame->GetCanvas()); 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(); InitProcTable();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);

View file

@ -3,7 +3,6 @@
#include "Emu/GS/RSXThread.h" #include "Emu/GS/RSXThread.h"
#include "GLBuffers.h" #include "GLBuffers.h"
#include "GLProgramBuffer.h" #include "GLProgramBuffer.h"
#include <wx/glcanvas.h>
#pragma comment(lib, "opengl32.lib") #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; 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); f.Write(alldata, texPixelCount * 4);
} }
u8* data = new u8[texPixelCount * 3]; u8* data = new u8[texPixelCount * 3];
@ -544,9 +543,9 @@ public:
*dst_a++ = *src++; *dst_a++ = *src++;
} }
wxImage out; rImage out;
out.Create(tex.GetWidth(), tex.GetHeight(), data, alpha); out.Create(tex.GetWidth(), tex.GetHeight(), data, alpha);
out.SaveFile(name, wxBITMAP_TYPE_PNG); out.SaveFile(name, rBITMAP_TYPE_PNG);
delete[] alldata; delete[] alldata;
//free(data); //free(data);
@ -555,14 +554,14 @@ public:
void Save(RSXTexture& tex) void Save(RSXTexture& tex)
{ {
static const wxString& dir_path = "textures"; static const std::string& dir_path = "textures";
static const wxString& file_fmt = dir_path + "/" + "tex[%d].png"; 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; u32 count = 0;
while(wxFileExists(wxString::Format(file_fmt, count))) count++; while(rFileExists(fmt::Format(file_fmt, count))) count++;
Save(tex, wxString::Format(file_fmt, count)); Save(tex, fmt::Format(file_fmt, count));
} }
void Bind() 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 class PostDrawObj
{ {
protected: protected:
@ -787,9 +768,9 @@ public:
} }
}; };
class GLGSRender class GLGSRender //TODO: find out why this used to inherit from wxWindow
: public wxWindow : //public wxWindow
, public GSRender /*,*/ public GSRender
{ {
private: private:
std::vector<u8> m_vdata; std::vector<u8> m_vdata;
@ -810,10 +791,10 @@ private:
GLrbo m_rbo; GLrbo m_rbo;
GLfbo m_fbo; GLfbo m_fbo;
wxGLContext* m_context; void* m_context;
public: public:
GLGSFrame* m_frame; rGLFrame* m_frame;
u32 m_draw_frames; u32 m_draw_frames;
u32 m_skip_frames; u32 m_skip_frames;

View file

@ -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)); ret += m_parr.AddParam(PARAM_NONE, "vec4", "tmp" + std::to_string(src[n].tmp_src));
break; break;
case 2: //input 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); ret += m_parr.AddParam(PARAM_IN, "vec4", reg_table[d1.input_src], d1.input_src);
} }

View file

@ -7,11 +7,6 @@
#include "Null/NullGSRender.h" #include "Null/NullGSRender.h"
#include "GL/GLGSRender.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) GSManager::GSManager() : m_render(nullptr)
{ {
} }

View file

@ -2,85 +2,9 @@
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
#include "Emu/Memory/Memory.h" #include "Emu/Memory/Memory.h"
#include "Emu/System.h" #include "Emu/System.h"
#include "rpcs3/rpcs3.h"
#include "GSRender.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) GSLockCurrent::GSLockCurrent(GSLockType type) : GSLock(Emu.GetGSManager().GetRender(), type)
{ {
} }

View file

@ -2,34 +2,6 @@
#include "Emu/GS/GCM.h" #include "Emu/GS/GCM.h"
#include "Emu/GS/RSXThread.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 struct GSRender : public RSXThread
{ {
virtual ~GSRender() virtual ~GSRender()

View file

@ -1,58 +1,22 @@
#pragma once #pragma once
#include "Emu/GS/GSRender.h" #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 class NullGSRender
: public wxWindow : public GSRender
, public GSRender
{ {
public: public:
NullGSFrame* m_frame;
NullGSRender() : m_frame(nullptr) NullGSRender()
{ {
m_frame = new NullGSFrame();
} }
virtual ~NullGSRender() virtual ~NullGSRender()
{ {
m_frame->Close();
} }
private: private:
virtual void OnInit() virtual void OnInit()
{ {
m_frame->Show();
} }
virtual void OnInitThread() virtual void OnInitThread()
@ -77,8 +41,5 @@ private:
virtual void Close() virtual void Close()
{ {
Stop();
if(m_frame->IsShown()) m_frame->Hide();
} }
}; };

View file

@ -1833,7 +1833,7 @@ void RSXThread::Task()
while(!TestDestroy()) while(!TestDestroy())
{ {
wxCriticalSectionLocker lock(m_cs_main); rCriticalSectionLocker lock(m_cs_main);
inc=1; inc=1;

View file

@ -142,9 +142,9 @@ public:
u32 m_draw_array_first; u32 m_draw_array_first;
public: public:
wxCriticalSection m_cs_main; rCriticalSection m_cs_main;
wxSemaphore m_sem_flush; rSemaphore m_sem_flush;
wxSemaphore m_sem_flip; rSemaphore m_sem_flip;
Callback m_flip_handler; Callback m_flip_handler;
public: public:

View file

@ -63,7 +63,7 @@ public:
static void CreateHDD(const std::string& path, u64 size, u64 block_size) 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; static const u64 cur_dir_block = 1;

View file

@ -1,10 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
#include "rpcs3/Ini.h" #include "rpcs3/Ini.h"
#include "rpcs3.h"
#include "Keyboard.h" #include "Keyboard.h"
#include "Null/NullKeyboardHandler.h" #include "Null/NullKeyboardHandler.h"
#include "Windows/WindowsKeyboardHandler.h"
KeyboardManager::KeyboardManager() KeyboardManager::KeyboardManager()
: m_keyboard_handler(nullptr) : m_keyboard_handler(nullptr)
@ -22,17 +20,13 @@ void KeyboardManager::Init(const u32 max_connect)
return; return;
// NOTE: Change these to std::make_unique assignments when C++14 comes out. // 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: selectedHandler = 0;
m_keyboard_handler.reset(new WindowsKeyboardHandler());
break;
default:
case 0:
m_keyboard_handler.reset(new NullKeyboardHandler());
break;
} }
m_keyboard_handler.reset(rPlatform::getKeyboardHandler(selectedHandler));
m_keyboard_handler->Init(max_connect); m_keyboard_handler->Init(max_connect);
m_inited = true; m_inited = true;

View file

@ -1,10 +1,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
#include "rpcs3/Ini.h" #include "rpcs3/Ini.h"
#include "rpcs3.h"
#include "Mouse.h" #include "Mouse.h"
#include "Null/NullMouseHandler.h" #include "Null/NullMouseHandler.h"
#include "Windows/WindowsMouseHandler.h"
MouseManager::MouseManager() MouseManager::MouseManager()
: m_mouse_handler(nullptr) : m_mouse_handler(nullptr)
@ -22,17 +20,13 @@ void MouseManager::Init(const u32 max_connect)
return; return;
// NOTE: Change these to std::make_unique assignments when C++14 is available. // 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: selectedHandler = 0;
m_mouse_handler.reset(new WindowsMouseHandler());
break;
default:
case 0:
m_mouse_handler.reset(new NullMouseHandler());
break;
} }
m_mouse_handler.reset(rPlatform::getMouseHandler(selectedHandler));
m_mouse_handler->Init(max_connect); m_mouse_handler->Init(max_connect);
m_inited = true; m_inited = true;

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "Emu/Io/KeyboardHandler.h" #include "Emu/Io/KeyboardHandler.h"
#include <cstring> //for memset
class NullKeyboardHandler final : public KeyboardHandlerBase class NullKeyboardHandler final : public KeyboardHandlerBase
{ {

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "Emu/Io/MouseHandler.h" #include "Emu/Io/MouseHandler.h"
#include <cstring> //for memset
class NullMouseHandler final : public MouseHandlerBase class NullMouseHandler final : public MouseHandlerBase
{ {

View file

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "Emu/Io/PadHandler.h" #include "Emu/Io/PadHandler.h"
#include <cstring> //for memset
class NullPadHandler final : public PadHandlerBase class NullPadHandler final : public PadHandlerBase
{ {

View file

@ -1,13 +1,16 @@
#include "stdafx.h" #include "stdafx.h"
#include "Emu/ConLog.h" #include "Emu/ConLog.h"
#include "rpcs3/Ini.h" #include "rpcs3/Ini.h"
#include "rpcs3.h"
#include "Pad.h" #include "Pad.h"
#include "Null/NullPadHandler.h" #include "Null/NullPadHandler.h"
#ifdef wxGUI
#include "Windows/WindowsPadHandler.h" #include "Windows/WindowsPadHandler.h"
#include "rpcs3.h"
#if defined(_WIN32) #if defined(_WIN32)
#include "XInput/XInputPadHandler.h" #include "XInput/XInputPadHandler.h"
#endif #endif
#endif
PadManager::PadManager() PadManager::PadManager()
: m_pad_handler(nullptr) : m_pad_handler(nullptr)
@ -25,23 +28,13 @@ void PadManager::Init(const u32 max_connect)
return; return;
// NOTE: Change these to std::make_unique assignments when C++14 is available. // 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: selectedHandler = 0;
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;
} }
m_pad_handler.reset(rPlatform::getPadHandler(selectedHandler));
m_pad_handler->Init(max_connect); m_pad_handler->Init(max_connect);
m_inited = true; m_inited = true;

View file

@ -1136,10 +1136,3 @@ typedef mem_list_ptr_t<u16, u32> mem16_ptr_t;
typedef mem_list_ptr_t<u32, u32> mem32_ptr_t; typedef mem_list_ptr_t<u32, u32> mem32_ptr_t;
typedef mem_list_ptr_t<u64, u32> mem64_ptr_t; typedef mem_list_ptr_t<u64, u32> 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<typename T> T re(const T val) { T res; se_t<T>::func(res, val); return res; }
template<typename T1, typename T2> void re(T1& dst, const T2 val) { se_t<T1>::func(dst, val); }

View file

@ -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 <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0006, cellAdec_init);
cellAtrac = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0013, cellAtrac_init);
cellAudio = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0011, cellAudio_init);
cellDmux = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0007, cellDmux_init);
cellFont = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0019, cellFont_init, cellFont_load, cellFont_unload);
sys_net = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back((u16)0x0000, sys_net_init);
sceNpTrophy = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload);
sceNp = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0016, sceNp_init);
cellUserInfo = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0032, cellUserInfo_init);
cellSysutil = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0015, cellSysutil_init);
cellSysutilAp = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0039, cellSysutilAp_init);
cellPngDec = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0018, cellPngDec_init);
cellNetCtl = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0014, cellNetCtl_init);
cellJpgDec = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x000f, cellJpgDec_init);
cellFontFT = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload);
cellGifDec = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0xf010, cellGifDec_init);
cellGcmSys = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload);
cellGame = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x003e, cellGame_init);
sys_io = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0017, sys_io_init);
cellL10n = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x001e, cellL10n_init);
cellPamf = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0012, cellPamf_init);
cellResc = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x001f, cellResc_init, cellResc_load, cellResc_unload);
cellRtc = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0009, cellRtc_init);
cellSpurs = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x000a, cellSpurs_init);
cellSync = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("cellSync", cellSync_init);
cellSysmodule = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("cellSysmodule", cellSysmodule_init);
cellVdec = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0005, cellVdec_init);
cellVpost = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back(0x0008, cellVpost_init);
libmixer = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("libmixer", libmixer_init);
sysPrxForUser = static_cast <Module*>(&(m_mod_init.back())) + 1;
m_mod_init.emplace_back("sysPrxForUser", sysPrxForUser_init);
sys_fs = static_cast <Module*>(&(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; i<m_modules_funcs_list.size(); ++i)
{
if (m_modules_funcs_list[i]->id == id)
{
return true;
}
}
return false;
}
bool ModuleManager::CallFunc(u32 num)
{
func_caller* func = nullptr;
{
std::lock_guard<std::mutex> lock(m_funcs_lock);
for (u32 i = 0; i<m_modules_funcs_list.size(); ++i)
{
if (m_modules_funcs_list[i]->id == num)
{
func = m_modules_funcs_list[i]->func;
break;
}
}
}
if (func)
{
(*func)();
return true;
}
return false;
}
bool ModuleManager::UnloadFunc(u32 id)
{
std::lock_guard<std::mutex> lock(m_funcs_lock);
for (u32 i = 0; i<m_modules_funcs_list.size(); ++i)
{
if (m_modules_funcs_list[i]->id == 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; j<m_max_module_id; ++j)
{
if (m_modules[i][j])
{
m_modules[i][j]->UnLoad();
}
}
}
std::lock_guard<std::mutex> lock(m_funcs_lock);
m_modules_funcs_list.clear();
}
Module* ModuleManager::GetModuleByName(const std::string& name)
{
for (u32 i = 0; i<m_max_module_id; ++i)
{
if (m_modules[0][i] && m_modules[0][i]->GetName() == 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; i<m_max_module_id; ++i)
{
if (m_modules[0][i] && m_modules[0][i]->GetID() == 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<std::mutex> guard(m_funcs_lock);
if (!IsLoadedFunc(func->id))
{
m_modules_funcs_list.push_back(func);
}
}

View file

@ -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<ModuleFunc *> m_modules_funcs_list;
std::vector<Module> 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);
};

View file

@ -6,322 +6,11 @@
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include <mutex> #include <mutex>
#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<ModuleFunc *> g_modules_funcs_list;
std::mutex g_funcs_lock;
std::vector<SFunc *> 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<Module*> 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; i<g_modules_funcs_list.size(); ++i)
{
if(g_modules_funcs_list[i]->id == id)
{
return true;
}
}
return false;
}
bool CallFunc(u32 num)
{
func_caller* func = nullptr;
{
std::lock_guard<std::mutex> lock(g_funcs_lock);
for(u32 i=0; i<g_modules_funcs_list.size(); ++i)
{
if(g_modules_funcs_list[i]->id == num)
{
func = g_modules_funcs_list[i]->func;
break;
}
}
}
if (func)
{
(*func)();
return true;
}
return false;
}
bool UnloadFunc(u32 id)
{
std::lock_guard<std::mutex> lock(g_funcs_lock);
for(u32 i=0; i<g_modules_funcs_list.size(); ++i)
{
if(g_modules_funcs_list[i]->id == 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; j<g_max_module_id; ++j)
{
if(g_modules[i][j])
{
g_modules[i][j]->UnLoad();
}
}
}
std::lock_guard<std::mutex> lock(g_funcs_lock);
g_modules_funcs_list.clear();
}
Module* GetModuleByName(const std::string& name)
{
for(u32 i=0; i<g_max_module_id; ++i)
{
if(g_modules[0][i] && g_modules[0][i]->GetName() == 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; i<g_max_module_id; ++i)
{
if(g_modules[0][i] && g_modules[0][i]->GetID() == 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) Module::Module(u16 id, const char* name)
: m_is_loaded(false) : m_is_loaded(false)
@ -330,7 +19,7 @@ Module::Module(u16 id, const char* name)
, m_load_func(nullptr) , m_load_func(nullptr)
, m_unload_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)()) 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_load_func(load)
, m_unload_func(unload) , m_unload_func(unload)
{ {
SetModule(m_id, this, init != nullptr); Emu.GetModuleManager().SetModule(m_id, this, init != nullptr);
if(init) init(); if(init) init();
} }
@ -350,10 +39,35 @@ Module::Module(u16 id, void (*init)(), void (*load)(), void (*unload)())
, m_load_func(load) , m_load_func(load)
, m_unload_func(unload) , m_unload_func(unload)
{ {
SetModule(m_id, this, init != nullptr); Emu.GetModuleManager().SetModule(m_id, this, init != nullptr);
if(init) init(); 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() Module::~Module()
{ {
UnLoad(); UnLoad();
@ -373,11 +87,7 @@ void Module::Load()
for(u32 i=0; i<m_funcs_list.size(); ++i) for(u32 i=0; i<m_funcs_list.size(); ++i)
{ {
std::lock_guard<std::mutex> lock(g_funcs_lock); Emu.GetModuleManager().AddFunc(m_funcs_list[i]);
if(IsLoadedFunc(m_funcs_list[i]->id)) continue;
g_modules_funcs_list.push_back(m_funcs_list[i]);
} }
SetLoaded(true); SetLoaded(true);
@ -392,7 +102,7 @@ void Module::UnLoad()
for(u32 i=0; i<m_funcs_list.size(); ++i) for(u32 i=0; i<m_funcs_list.size(); ++i)
{ {
UnloadFunc(m_funcs_list[i]->id); Emu.GetModuleManager().UnloadFunc(m_funcs_list[i]->id);
} }
SetLoaded(false); SetLoaded(false);
@ -400,16 +110,16 @@ void Module::UnLoad()
bool Module::Load(u32 id) bool Module::Load(u32 id)
{ {
std::lock_guard<std::mutex> lock(g_funcs_lock); //std::lock_guard<std::mutex> lock(g_funcs_lock);
if(IsLoadedFunc(id)) return false; if(Emu.GetModuleManager().IsLoadedFunc(id)) return false;
for(u32 i=0; i<m_funcs_list.size(); ++i) for(u32 i=0; i<m_funcs_list.size(); ++i)
{ {
if(m_funcs_list[i]->id == id) if(m_funcs_list[i]->id == 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; return true;
} }
} }
@ -419,7 +129,7 @@ bool Module::Load(u32 id)
bool Module::UnLoad(u32 id) bool Module::UnLoad(u32 id)
{ {
return UnloadFunc(id); return Emu.GetModuleManager().UnloadFunc(id);
} }
void Module::SetLoaded(bool loaded) void Module::SetLoaded(bool loaded)

View file

@ -42,12 +42,10 @@ struct SFunc
} }
}; };
extern std::vector<SFunc *> g_static_funcs_list;
class Module class Module
{ {
std::string m_name; std::string m_name;
const u16 m_id; u16 m_id;
bool m_is_loaded; bool m_is_loaded;
void (*m_load_func)(); void (*m_load_func)();
void (*m_unload_func)(); void (*m_unload_func)();
@ -59,6 +57,12 @@ public:
Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr);
Module(u16 id, 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(); ~Module();
void Load(); void Load();
@ -151,14 +155,6 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
op.crc = re(op.crc); op.crc = re(op.crc);
sf->ops.push_back(op); 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);

View file

@ -19,8 +19,9 @@ extern "C"
#include "cellAdec.h" #include "cellAdec.h"
void cellAdec_init(); //void cellAdec_init();
Module cellAdec(0x0006, cellAdec_init); //Module cellAdec(0x0006, cellAdec_init);
extern Module *cellAdec=nullptr;
int adecRawRead(void* opaque, u8* buf, int buf_size) 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); adec.adecCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU);
u32 adec_id = cellAdec.GetNewId(data); u32 adec_id = cellAdec->GetNewId(data);
adec.id = adec_id; adec.id = adec_id;
@ -530,7 +531,7 @@ bool adecCheckType(AudioCodecType type)
case CELL_ADEC_TYPE_CELP: case CELL_ADEC_TYPE_CELP:
case CELL_ADEC_TYPE_M4AAC: case CELL_ADEC_TYPE_M4AAC:
case CELL_ADEC_TYPE_CELP8: case CELL_ADEC_TYPE_CELP8:
cellAdec.Error("Unimplemented audio codec type (%d)", type); cellAdec->Error("Unimplemented audio codec type (%d)", type);
break; break;
default: default:
return false; return false;
@ -541,7 +542,7 @@ bool adecCheckType(AudioCodecType type)
int cellAdecQueryAttr(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecAttr> attr) int cellAdecQueryAttr(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecAttr> 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()) if (!type.IsGood() || !attr.IsGood())
{ {
@ -560,7 +561,7 @@ int cellAdecQueryAttr(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecAttr> attr
int cellAdecOpen(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResource> res, mem_ptr_t<CellAdecCb> cb, mem32_t handle) int cellAdecOpen(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResource> res, mem_ptr_t<CellAdecCb> 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()); type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
@ -577,7 +578,7 @@ int cellAdecOpen(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResource> res,
int cellAdecOpenEx(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResourceEx> res, mem_ptr_t<CellAdecCb> cb, mem32_t handle) int cellAdecOpenEx(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResourceEx> res, mem_ptr_t<CellAdecCb> 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()); type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
@ -594,7 +595,7 @@ int cellAdecOpenEx(mem_ptr_t<CellAdecType> type, mem_ptr_t<CellAdecResourceEx> r
int cellAdecClose(u32 handle) int cellAdecClose(u32 handle)
{ {
cellAdec.Warning("cellAdecClose(handle=%d)", handle); cellAdec->Warning("cellAdecClose(handle=%d)", handle);
AudioDecoder* adec; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -621,7 +622,7 @@ int cellAdecClose(u32 handle)
int cellAdecStartSeq(u32 handle, u32 param_addr) 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; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -636,7 +637,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
} }
else*/ else*/
{ {
cellAdec.Warning("cellAdecStartSeq: (TODO) initialization"); cellAdec->Warning("cellAdecStartSeq: (TODO) initialization");
} }
adec->job.Push(task); adec->job.Push(task);
@ -645,7 +646,7 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
int cellAdecEndSeq(u32 handle) int cellAdecEndSeq(u32 handle)
{ {
cellAdec.Warning("cellAdecEndSeq(handle=%d)", handle); cellAdec->Warning("cellAdecEndSeq(handle=%d)", handle);
AudioDecoder* adec; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -659,7 +660,7 @@ int cellAdecEndSeq(u32 handle)
int cellAdecDecodeAu(u32 handle, mem_ptr_t<CellAdecAuInfo> auInfo) int cellAdecDecodeAu(u32 handle, mem_ptr_t<CellAdecAuInfo> 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; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -685,7 +686,7 @@ int cellAdecDecodeAu(u32 handle, mem_ptr_t<CellAdecAuInfo> auInfo)
int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) 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; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, 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) 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; AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec)) if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -828,15 +829,15 @@ int cellAdecGetPcmItem(u32 handle, mem32_t pcmItem_ptr)
void cellAdec_init() void cellAdec_init()
{ {
cellAdec.AddFunc(0x7e4a4a49, cellAdecQueryAttr); cellAdec->AddFunc(0x7e4a4a49, cellAdecQueryAttr);
cellAdec.AddFunc(0xd00a6988, cellAdecOpen); cellAdec->AddFunc(0xd00a6988, cellAdecOpen);
cellAdec.AddFunc(0x8b5551a4, cellAdecOpenEx); cellAdec->AddFunc(0x8b5551a4, cellAdecOpenEx);
cellAdec.AddFunc(0x847d2380, cellAdecClose); cellAdec->AddFunc(0x847d2380, cellAdecClose);
cellAdec.AddFunc(0x487b613e, cellAdecStartSeq); cellAdec->AddFunc(0x487b613e, cellAdecStartSeq);
cellAdec.AddFunc(0xe2ea549b, cellAdecEndSeq); cellAdec->AddFunc(0xe2ea549b, cellAdecEndSeq);
cellAdec.AddFunc(0x1529e506, cellAdecDecodeAu); cellAdec->AddFunc(0x1529e506, cellAdecDecodeAu);
cellAdec.AddFunc(0x97ff2af1, cellAdecGetPcm); cellAdec->AddFunc(0x97ff2af1, cellAdecGetPcm);
cellAdec.AddFunc(0xbd75f78b, cellAdecGetPcmItem); cellAdec->AddFunc(0xbd75f78b, cellAdecGetPcmItem);
av_register_all(); av_register_all();
avcodec_register_all(); avcodec_register_all();

View file

@ -7,14 +7,13 @@
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
void cellAtrac_init(); extern Module *cellAtrac = nullptr;
Module cellAtrac(0x0013, cellAtrac_init);
#include "cellAtrac.h" #include "cellAtrac.h"
int cellAtracSetDataAndGetMemSize(mem_ptr_t<CellAtracHandle> pHandle, u32 pucBufferAddr, u32 uiReadByte, u32 uiBufferByte, mem32_t puiWorkMemByte) int cellAtracSetDataAndGetMemSize(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), pucBufferAddr, uiReadByte, uiBufferByte, puiWorkMemByte.GetAddr());
puiWorkMemByte = 0x1000; // unproved puiWorkMemByte = 0x1000; // unproved
@ -23,7 +22,7 @@ int cellAtracSetDataAndGetMemSize(mem_ptr_t<CellAtracHandle> pHandle, u32 pucBuf
int cellAtracCreateDecoder(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, u32 uiSpuThreadPriority) int cellAtracCreateDecoder(mem_ptr_t<CellAtracHandle> 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.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, uiSpuThreadPriority);
pHandle->data.pucWorkMem_addr = pucWorkMem_addr; pHandle->data.pucWorkMem_addr = pucWorkMem_addr;
@ -32,7 +31,7 @@ int cellAtracCreateDecoder(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_ad
int cellAtracCreateDecoderExt(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, mem_ptr_t<CellAtracExtRes> pExtRes) int cellAtracCreateDecoderExt(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem_addr, u32 uiPpuThreadPriority, mem_ptr_t<CellAtracExtRes> 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.GetAddr(), pucWorkMem_addr, uiPpuThreadPriority, pExtRes.GetAddr());
pHandle->data.pucWorkMem_addr = pucWorkMem_addr; pHandle->data.pucWorkMem_addr = pucWorkMem_addr;
@ -41,13 +40,13 @@ int cellAtracCreateDecoderExt(mem_ptr_t<CellAtracHandle> pHandle, u32 pucWorkMem
int cellAtracDeleteDecoder(mem_ptr_t<CellAtracHandle> pHandle) int cellAtracDeleteDecoder(mem_ptr_t<CellAtracHandle> pHandle)
{ {
cellAtrac.Error("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr()); cellAtrac->Error("cellAtracDeleteDecoder(pHandle=0x%x)", pHandle.GetAddr());
return CELL_OK; return CELL_OK;
} }
int cellAtracDecode(mem_ptr_t<CellAtracHandle> pHandle, u32 pfOutAddr, mem32_t puiSamples, mem32_t puiFinishflag, mem32_t piRemainFrame) int cellAtracDecode(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), pfOutAddr, puiSamples.GetAddr(), puiFinishflag.GetAddr(), piRemainFrame.GetAddr());
puiSamples = 0; puiSamples = 0;
@ -58,7 +57,7 @@ int cellAtracDecode(mem_ptr_t<CellAtracHandle> pHandle, u32 pfOutAddr, mem32_t p
int cellAtracGetStreamDataInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t ppucWritePointer, mem32_t puiWritableByte, mem32_t puiReadPosition) int cellAtracGetStreamDataInfo(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), ppucWritePointer.GetAddr(), puiWritableByte.GetAddr(), puiReadPosition.GetAddr());
ppucWritePointer = pHandle->data.pucWorkMem_addr; ppucWritePointer = pHandle->data.pucWorkMem_addr;
@ -69,13 +68,13 @@ int cellAtracGetStreamDataInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t ppucW
int cellAtracAddStreamData(mem_ptr_t<CellAtracHandle> pHandle, u32 uiAddByte) int cellAtracAddStreamData(mem_ptr_t<CellAtracHandle> 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; return CELL_OK;
} }
int cellAtracGetRemainFrame(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piRemainFrame) int cellAtracGetRemainFrame(mem_ptr_t<CellAtracHandle> 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; piRemainFrame = CELL_ATRAC_ALLDATA_IS_ON_MEMORY;
return CELL_OK; return CELL_OK;
@ -83,7 +82,7 @@ int cellAtracGetRemainFrame(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piRemain
int cellAtracGetVacantSize(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiVacantSize) int cellAtracGetVacantSize(mem_ptr_t<CellAtracHandle> 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; puiVacantSize = 0x1000;
return CELL_OK; return CELL_OK;
@ -91,13 +90,13 @@ int cellAtracGetVacantSize(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiVacant
int cellAtracIsSecondBufferNeeded(mem_ptr_t<CellAtracHandle> pHandle) int cellAtracIsSecondBufferNeeded(mem_ptr_t<CellAtracHandle> pHandle)
{ {
cellAtrac.Error("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr()); cellAtrac->Error("cellAtracIsSecondBufferNeeded(pHandle=0x%x)", pHandle.GetAddr());
return CELL_OK; return CELL_OK;
} }
int cellAtracGetSecondBufferInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiReadPosition, mem32_t puiDataByte) int cellAtracGetSecondBufferInfo(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), puiReadPosition.GetAddr(), puiDataByte.GetAddr());
puiReadPosition = 0; puiReadPosition = 0;
@ -107,14 +106,14 @@ int cellAtracGetSecondBufferInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t pui
int cellAtracSetSecondBuffer(mem_ptr_t<CellAtracHandle> pHandle, u32 pucSecondBufferAddr, u32 uiSecondBufferByte) int cellAtracSetSecondBuffer(mem_ptr_t<CellAtracHandle> 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); pHandle.GetAddr(), pucSecondBufferAddr, uiSecondBufferByte);
return CELL_OK; return CELL_OK;
} }
int cellAtracGetChannel(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiChannel) int cellAtracGetChannel(mem_ptr_t<CellAtracHandle> 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; puiChannel = 2;
return CELL_OK; return CELL_OK;
@ -122,7 +121,7 @@ int cellAtracGetChannel(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiChannel)
int cellAtracGetMaxSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiMaxSample) int cellAtracGetMaxSample(mem_ptr_t<CellAtracHandle> 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; puiMaxSample = 512;
return CELL_OK; return CELL_OK;
@ -130,7 +129,7 @@ int cellAtracGetMaxSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiMaxSamp
int cellAtracGetNextSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiNextSample) int cellAtracGetNextSample(mem_ptr_t<CellAtracHandle> 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; puiNextSample = 0;
return CELL_OK; return CELL_OK;
@ -138,7 +137,7 @@ int cellAtracGetNextSample(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiNextSa
int cellAtracGetSoundInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piEndSample, mem32_t piLoopStartSample, mem32_t piLoopEndSample) int cellAtracGetSoundInfo(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), piEndSample.GetAddr(), piLoopStartSample.GetAddr(), piLoopEndSample.GetAddr());
piEndSample = 0; piEndSample = 0;
@ -149,7 +148,7 @@ int cellAtracGetSoundInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piEndSampl
int cellAtracGetNextDecodePosition(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiSamplePosition) int cellAtracGetNextDecodePosition(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), puiSamplePosition.GetAddr());
puiSamplePosition = 0; puiSamplePosition = 0;
@ -158,7 +157,7 @@ int cellAtracGetNextDecodePosition(mem_ptr_t<CellAtracHandle> pHandle, mem32_t p
int cellAtracGetBitrate(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiBitrate) int cellAtracGetBitrate(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), puiBitrate.GetAddr());
puiBitrate = 128; puiBitrate = 128;
@ -167,7 +166,7 @@ int cellAtracGetBitrate(mem_ptr_t<CellAtracHandle> pHandle, mem32_t puiBitrate)
int cellAtracGetLoopInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piLoopNum, mem32_t puiLoopStatus) int cellAtracGetLoopInfo(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), piLoopNum.GetAddr(), puiLoopStatus.GetAddr());
piLoopNum = 0; piLoopNum = 0;
@ -177,13 +176,13 @@ int cellAtracGetLoopInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piLoopNum,
int cellAtracSetLoopNum(mem_ptr_t<CellAtracHandle> pHandle, int iLoopNum) int cellAtracSetLoopNum(mem_ptr_t<CellAtracHandle> 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; return CELL_OK;
} }
int cellAtracGetBufferInfoForResetting(mem_ptr_t<CellAtracHandle> pHandle, u32 uiSample, mem_ptr_t<CellAtracBufferInfo> pBufferInfo) int cellAtracGetBufferInfoForResetting(mem_ptr_t<CellAtracHandle> pHandle, u32 uiSample, mem_ptr_t<CellAtracBufferInfo> 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()); pHandle.GetAddr(), uiSample, pBufferInfo.GetAddr());
pBufferInfo->pucWriteAddr = pHandle->data.pucWorkMem_addr; pBufferInfo->pucWriteAddr = pHandle->data.pucWorkMem_addr;
@ -195,14 +194,14 @@ int cellAtracGetBufferInfoForResetting(mem_ptr_t<CellAtracHandle> pHandle, u32 u
int cellAtracResetPlayPosition(mem_ptr_t<CellAtracHandle> pHandle, u32 uiSample, u32 uiWriteByte) int cellAtracResetPlayPosition(mem_ptr_t<CellAtracHandle> 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); pHandle.GetAddr(), uiSample, uiWriteByte);
return CELL_OK; return CELL_OK;
} }
int cellAtracGetInternalErrorInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t piResult) int cellAtracGetInternalErrorInfo(mem_ptr_t<CellAtracHandle> 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()); pHandle.GetAddr(), piResult.GetAddr());
piResult = 0; piResult = 0;
@ -211,34 +210,34 @@ int cellAtracGetInternalErrorInfo(mem_ptr_t<CellAtracHandle> pHandle, mem32_t pi
void cellAtrac_init() void cellAtrac_init()
{ {
cellAtrac.AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize); cellAtrac->AddFunc(0x66afc68e, cellAtracSetDataAndGetMemSize);
cellAtrac.AddFunc(0xfa293e88, cellAtracCreateDecoder); cellAtrac->AddFunc(0xfa293e88, cellAtracCreateDecoder);
cellAtrac.AddFunc(0x2642d4cc, cellAtracCreateDecoderExt); cellAtrac->AddFunc(0x2642d4cc, cellAtracCreateDecoderExt);
cellAtrac.AddFunc(0x761cb9be, cellAtracDeleteDecoder); cellAtrac->AddFunc(0x761cb9be, cellAtracDeleteDecoder);
cellAtrac.AddFunc(0x8eb0e65f, cellAtracDecode); cellAtrac->AddFunc(0x8eb0e65f, cellAtracDecode);
cellAtrac.AddFunc(0x2bfff084, cellAtracGetStreamDataInfo); cellAtrac->AddFunc(0x2bfff084, cellAtracGetStreamDataInfo);
cellAtrac.AddFunc(0x46cfc013, cellAtracAddStreamData); cellAtrac->AddFunc(0x46cfc013, cellAtracAddStreamData);
cellAtrac.AddFunc(0xdfab73aa, cellAtracGetRemainFrame); cellAtrac->AddFunc(0xdfab73aa, cellAtracGetRemainFrame);
cellAtrac.AddFunc(0xc9a95fcb, cellAtracGetVacantSize); cellAtrac->AddFunc(0xc9a95fcb, cellAtracGetVacantSize);
cellAtrac.AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded); cellAtrac->AddFunc(0x99efe171, cellAtracIsSecondBufferNeeded);
cellAtrac.AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo); cellAtrac->AddFunc(0xbe07f05e, cellAtracGetSecondBufferInfo);
cellAtrac.AddFunc(0x06ddb53e, cellAtracSetSecondBuffer); cellAtrac->AddFunc(0x06ddb53e, cellAtracSetSecondBuffer);
cellAtrac.AddFunc(0x0f9667b6, cellAtracGetChannel); cellAtrac->AddFunc(0x0f9667b6, cellAtracGetChannel);
cellAtrac.AddFunc(0x5f62d546, cellAtracGetMaxSample); cellAtrac->AddFunc(0x5f62d546, cellAtracGetMaxSample);
cellAtrac.AddFunc(0x4797d1ff, cellAtracGetNextSample); cellAtrac->AddFunc(0x4797d1ff, cellAtracGetNextSample);
cellAtrac.AddFunc(0xcf01d5d4, cellAtracGetSoundInfo); cellAtrac->AddFunc(0xcf01d5d4, cellAtracGetSoundInfo);
cellAtrac.AddFunc(0x7b22e672, cellAtracGetNextDecodePosition); cellAtrac->AddFunc(0x7b22e672, cellAtracGetNextDecodePosition);
cellAtrac.AddFunc(0x006016da, cellAtracGetBitrate); cellAtrac->AddFunc(0x006016da, cellAtracGetBitrate);
cellAtrac.AddFunc(0xab6b6dbf, cellAtracGetLoopInfo); cellAtrac->AddFunc(0xab6b6dbf, cellAtracGetLoopInfo);
cellAtrac.AddFunc(0x78ba5c41, cellAtracSetLoopNum); cellAtrac->AddFunc(0x78ba5c41, cellAtracSetLoopNum);
cellAtrac.AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting); cellAtrac->AddFunc(0x99fb73d1, cellAtracGetBufferInfoForResetting);
cellAtrac.AddFunc(0x7772eb2b, cellAtracResetPlayPosition); cellAtrac->AddFunc(0x7772eb2b, cellAtracResetPlayPosition);
cellAtrac.AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo); cellAtrac->AddFunc(0xb5c11938, cellAtracGetInternalErrorInfo);
} }

View file

@ -11,8 +11,9 @@
#include "Emu/Audio/AudioManager.h" #include "Emu/Audio/AudioManager.h"
#include "Emu/Audio/AudioDumper.h" #include "Emu/Audio/AudioDumper.h"
void cellAudio_init(); //void cellAudio_init();
Module cellAudio(0x0011, cellAudio_init); //Module cellAudio(0x0011, cellAudio_init);
extern Module *cellAudio = nullptr;
static SMutexGeneral audioMutex; static SMutexGeneral audioMutex;
@ -24,7 +25,7 @@ static const bool g_is_u16 = Ini.AudioConvertToU16.GetValue();
int cellAudioInit() int cellAudioInit()
{ {
cellAudio.Warning("cellAudioInit()"); cellAudio->Warning("cellAudioInit()");
if (m_config.m_is_audio_initialized) if (m_config.m_is_audio_initialized)
{ {
@ -490,7 +491,7 @@ abort:
int cellAudioQuit() int cellAudioQuit()
{ {
cellAudio.Warning("cellAudioQuit()"); cellAudio->Warning("cellAudioQuit()");
if (!m_config.m_is_audio_initialized) if (!m_config.m_is_audio_initialized)
{ {
@ -517,7 +518,7 @@ int cellAudioQuit()
int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum) int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
{ {
cellAudio.Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.GetAddr(), portNum.GetAddr()); cellAudio->Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.GetAddr(), portNum.GetAddr());
if(!audioParam.IsGood() || !portNum.IsGood()) if(!audioParam.IsGood() || !portNum.IsGood())
{ {
@ -553,7 +554,7 @@ int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
} }
portNum = i; 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.channel, port.block, port.attr, port.level, i);
port.m_is_audio_port_opened = true; port.m_is_audio_port_opened = true;
@ -570,7 +571,7 @@ int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfig) int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> 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) if (!portConfig.IsGood() || portNum >= m_config.AUDIO_PORT_COUNT)
{ {
@ -598,7 +599,7 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfi
portConfig->portAddr = m_config.m_buffer + (128 * 1024 * portNum); // 0x20020000 portConfig->portAddr = m_config.m_buffer + (128 * 1024 * portNum); // 0x20020000
portConfig->readIndexAddr = m_config.m_indexes + (sizeof(u64) * portNum); // 0x20010010 on ps3 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); (u32)portConfig->nChannel, (u32)portConfig->nBlock, (u32)portConfig->portSize, (u32)portConfig->portAddr, (u32)portConfig->readIndexAddr);
// portAddr - readIndexAddr == 0xFFF0 on ps3 // portAddr - readIndexAddr == 0xFFF0 on ps3
@ -607,7 +608,7 @@ int cellAudioGetPortConfig(u32 portNum, mem_ptr_t<CellAudioPortConfig> portConfi
int cellAudioPortStart(u32 portNum) 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) if (portNum >= m_config.AUDIO_PORT_COUNT)
{ {
@ -631,7 +632,7 @@ int cellAudioPortStart(u32 portNum)
int cellAudioPortClose(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) if (portNum >= m_config.AUDIO_PORT_COUNT)
{ {
@ -651,7 +652,7 @@ int cellAudioPortClose(u32 portNum)
int cellAudioPortStop(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) if (portNum >= m_config.AUDIO_PORT_COUNT)
{ {
@ -674,7 +675,7 @@ int cellAudioPortStop(u32 portNum)
int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp) 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) 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) 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) if (portNum >= m_config.AUDIO_PORT_COUNT)
{ {
@ -723,7 +724,7 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
if (blockNo >= port.block) if (blockNo >= port.block)
{ {
cellAudio.Error("cellAudioGetPortBlockTag: wrong blockNo(%lld)", blockNo); cellAudio->Error("cellAudioGetPortBlockTag: wrong blockNo(%lld)", blockNo);
return CELL_AUDIO_ERROR_PARAM; return CELL_AUDIO_ERROR_PARAM;
} }
@ -746,14 +747,14 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
int cellAudioSetPortLevel(u32 portNum, float level) 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; return CELL_OK;
} }
// Utility Functions // Utility Functions
int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key) 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); SMutexGeneralLocker lock(audioMutex);
@ -773,7 +774,7 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
return CELL_AUDIO_ERROR_EVENT_QUEUE; return CELL_AUDIO_ERROR_EVENT_QUEUE;
} }
id = cellAudio.GetNewId(eq); id = cellAudio->GetNewId(eq);
key = event_key; key = event_key;
return CELL_OK; 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) 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; return CELL_OK;
} }
int cellAudioSetNotifyEventQueue(u64 key) int cellAudioSetNotifyEventQueue(u64 key)
{ {
cellAudio.Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key); cellAudio->Warning("cellAudioSetNotifyEventQueue(key=0x%llx)", key);
SMutexGeneralLocker lock(audioMutex); SMutexGeneralLocker lock(audioMutex);
@ -813,13 +814,13 @@ int cellAudioSetNotifyEventQueue(u64 key)
int cellAudioSetNotifyEventQueueEx(u64 key, u32 iFlags) 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; return CELL_OK;
} }
int cellAudioRemoveNotifyEventQueue(u64 key) int cellAudioRemoveNotifyEventQueue(u64 key)
{ {
cellAudio.Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key); cellAudio->Warning("cellAudioRemoveNotifyEventQueue(key=0x%llx)", key);
SMutexGeneralLocker lock(audioMutex); SMutexGeneralLocker lock(audioMutex);
@ -853,68 +854,68 @@ int cellAudioRemoveNotifyEventQueue(u64 key)
int cellAudioRemoveNotifyEventQueueEx(u64 key, u32 iFlags) 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; return CELL_OK;
} }
int cellAudioAddData(u32 portNum, mem32_t src, u32 samples, float volume) 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; return CELL_OK;
} }
int cellAudioAdd2chData(u32 portNum, mem32_t src, u32 samples, float volume) 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; return CELL_OK;
} }
int cellAudioAdd6chData(u32 portNum, mem32_t src, float volume) 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; return CELL_OK;
} }
int cellAudioMiscSetAccessoryVolume(u32 devNum, float volume) 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; return CELL_OK;
} }
int cellAudioSendAck(u64 data3) int cellAudioSendAck(u64 data3)
{ {
cellAudio.Error("cellAudioSendAck(data3=0x%llx)", data3); cellAudio->Error("cellAudioSendAck(data3=0x%llx)", data3);
return CELL_OK; return CELL_OK;
} }
int cellAudioSetPersonalDevice(int iPersonalStream, int iDevice) 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; return CELL_OK;
} }
int cellAudioUnsetPersonalDevice(int iPersonalStream) int cellAudioUnsetPersonalDevice(int iPersonalStream)
{ {
cellAudio.Error("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream); cellAudio->Error("cellAudioUnsetPersonalDevice(iPersonalStream=0x%x)", iPersonalStream);
return CELL_OK; return CELL_OK;
} }
void cellAudio_init() void cellAudio_init()
{ {
cellAudio.AddFunc(0x0b168f92, cellAudioInit); cellAudio->AddFunc(0x0b168f92, cellAudioInit);
cellAudio.AddFunc(0x4129fe2d, cellAudioPortClose); cellAudio->AddFunc(0x4129fe2d, cellAudioPortClose);
cellAudio.AddFunc(0x5b1e2c73, cellAudioPortStop); cellAudio->AddFunc(0x5b1e2c73, cellAudioPortStop);
cellAudio.AddFunc(0x74a66af0, cellAudioGetPortConfig); cellAudio->AddFunc(0x74a66af0, cellAudioGetPortConfig);
cellAudio.AddFunc(0x89be28f2, cellAudioPortStart); cellAudio->AddFunc(0x89be28f2, cellAudioPortStart);
cellAudio.AddFunc(0xca5ac370, cellAudioQuit); cellAudio->AddFunc(0xca5ac370, cellAudioQuit);
cellAudio.AddFunc(0xcd7bc431, cellAudioPortOpen); cellAudio->AddFunc(0xcd7bc431, cellAudioPortOpen);
cellAudio.AddFunc(0x56dfe179, cellAudioSetPortLevel); cellAudio->AddFunc(0x56dfe179, cellAudioSetPortLevel);
cellAudio.AddFunc(0x04af134e, cellAudioCreateNotifyEventQueue); cellAudio->AddFunc(0x04af134e, cellAudioCreateNotifyEventQueue);
cellAudio.AddFunc(0x31211f6b, cellAudioMiscSetAccessoryVolume); cellAudio->AddFunc(0x31211f6b, cellAudioMiscSetAccessoryVolume);
cellAudio.AddFunc(0x377e0cd9, cellAudioSetNotifyEventQueue); cellAudio->AddFunc(0x377e0cd9, cellAudioSetNotifyEventQueue);
cellAudio.AddFunc(0x4109d08c, cellAudioGetPortTimestamp); cellAudio->AddFunc(0x4109d08c, cellAudioGetPortTimestamp);
cellAudio.AddFunc(0x9e4b1db8, cellAudioAdd2chData); cellAudio->AddFunc(0x9e4b1db8, cellAudioAdd2chData);
cellAudio.AddFunc(0xdab029aa, cellAudioAddData); cellAudio->AddFunc(0xdab029aa, cellAudioAddData);
cellAudio.AddFunc(0xe4046afe, cellAudioGetPortBlockTag); cellAudio->AddFunc(0xe4046afe, cellAudioGetPortBlockTag);
cellAudio.AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue); cellAudio->AddFunc(0xff3626fd, cellAudioRemoveNotifyEventQueue);
} }

View file

@ -10,8 +10,9 @@
#include "cellPamf.h" #include "cellPamf.h"
#include "cellDmux.h" #include "cellDmux.h"
void cellDmux_init(); //void cellDmux_init();
Module cellDmux(0x0007, cellDmux_init); //Module cellDmux(0x0007, cellDmux_init);
Module *cellDmux = nullptr;
void dmuxQueryAttr(u32 info_addr /* may be 0 */, mem_ptr_t<CellDmuxAttr> attr) void dmuxQueryAttr(u32 info_addr /* may be 0 */, mem_ptr_t<CellDmuxAttr> attr)
{ {
@ -28,7 +29,7 @@ void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, const mem_ptr_t<CellCodecEsFi
else else
attr->memSize = 0x8000; // 0x73d9 from ps3 attr->memSize = 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); (u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2);
} }
@ -38,7 +39,7 @@ u32 dmuxOpen(Demuxer* data)
dmux.dmuxCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU); dmux.dmuxCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU);
u32 dmux_id = cellDmux.GetNewId(data); u32 dmux_id = cellDmux->GetNewId(data);
dmux.id = dmux_id; dmux.id = dmux_id;
@ -463,7 +464,7 @@ u32 dmuxOpen(Demuxer* data)
int cellDmuxQueryAttr(const mem_ptr_t<CellDmuxType> demuxerType, mem_ptr_t<CellDmuxAttr> demuxerAttr) int cellDmuxQueryAttr(const mem_ptr_t<CellDmuxType> demuxerType, mem_ptr_t<CellDmuxAttr> 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()) if (!demuxerType.IsGood() || !demuxerAttr.IsGood())
{ {
@ -481,7 +482,7 @@ int cellDmuxQueryAttr(const mem_ptr_t<CellDmuxType> demuxerType, mem_ptr_t<CellD
int cellDmuxQueryAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, mem_ptr_t<CellDmuxAttr> demuxerAttr) int cellDmuxQueryAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, mem_ptr_t<CellDmuxAttr> 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()) if (!demuxerType2.IsGood() || !demuxerAttr.IsGood())
{ {
@ -500,7 +501,7 @@ int cellDmuxQueryAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, mem_ptr_t<Ce
int cellDmuxOpen(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellDmuxResource> demuxerResource, int cellDmuxOpen(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellDmuxResource> demuxerResource,
const mem_ptr_t<CellDmuxCb> demuxerCb, mem32_t demuxerHandle) const mem_ptr_t<CellDmuxCb> 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()); demuxerType.GetAddr(), demuxerResource.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
if (!demuxerType.IsGood() || !demuxerResource.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) if (!demuxerType.IsGood() || !demuxerResource.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
@ -528,7 +529,7 @@ int cellDmuxOpen(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<Cell
int cellDmuxOpenEx(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellDmuxResourceEx> demuxerResourceEx, int cellDmuxOpenEx(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellDmuxResourceEx> demuxerResourceEx,
const mem_ptr_t<CellDmuxCb> demuxerCb, mem32_t demuxerHandle) const mem_ptr_t<CellDmuxCb> 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()); demuxerType.GetAddr(), demuxerResourceEx.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
if (!demuxerType.IsGood() || !demuxerResourceEx.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) if (!demuxerType.IsGood() || !demuxerResourceEx.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
@ -556,7 +557,7 @@ int cellDmuxOpenEx(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<Ce
int cellDmuxOpen2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<CellDmuxResource2> demuxerResource2, int cellDmuxOpen2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<CellDmuxResource2> demuxerResource2,
const mem_ptr_t<CellDmuxCb> demuxerCb, mem32_t demuxerHandle) const mem_ptr_t<CellDmuxCb> 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()); demuxerType2.GetAddr(), demuxerResource2.GetAddr(), demuxerCb.GetAddr(), demuxerHandle.GetAddr());
if (!demuxerType2.IsGood() || !demuxerResource2.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood()) if (!demuxerType2.IsGood() || !demuxerResource2.IsGood() || !demuxerCb.IsGood() || !demuxerHandle.IsGood())
@ -583,7 +584,7 @@ int cellDmuxOpen2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<C
int cellDmuxClose(u32 demuxerHandle) int cellDmuxClose(u32 demuxerHandle)
{ {
cellDmux.Warning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle); cellDmux->Warning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle);
Demuxer* dmux; Demuxer* dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, 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) 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); demuxerHandle, streamAddress, streamSize, discontinuity, userData);
Demuxer* dmux; Demuxer* dmux;
@ -661,7 +662,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize
int cellDmuxResetStream(u32 demuxerHandle) int cellDmuxResetStream(u32 demuxerHandle)
{ {
cellDmux.Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle); cellDmux->Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle);
Demuxer* dmux; Demuxer* dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -676,7 +677,7 @@ int cellDmuxResetStream(u32 demuxerHandle)
int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
{ {
cellDmux.Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle); cellDmux->Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle);
Demuxer* dmux; Demuxer* dmux;
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux)) if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
@ -703,7 +704,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
int cellDmuxQueryEsAttr(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellCodecEsFilterId> esFilterId, int cellDmuxQueryEsAttr(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr_t<CellCodecEsFilterId> esFilterId,
const u32 esSpecificInfo_addr, mem_ptr_t<CellDmuxEsAttr> esAttr) const u32 esSpecificInfo_addr, mem_ptr_t<CellDmuxEsAttr> 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()); demuxerType.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr());
if (!demuxerType.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood()) if (!demuxerType.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood())
@ -713,7 +714,7 @@ int cellDmuxQueryEsAttr(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) 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; return CELL_DMUX_ERROR_FATAL;
} }
@ -731,7 +732,7 @@ int cellDmuxQueryEsAttr(const mem_ptr_t<CellDmuxType> demuxerType, const mem_ptr
int cellDmuxQueryEsAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<CellCodecEsFilterId> esFilterId, int cellDmuxQueryEsAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_ptr_t<CellCodecEsFilterId> esFilterId,
const u32 esSpecificInfo_addr, mem_ptr_t<CellDmuxEsAttr> esAttr) const u32 esSpecificInfo_addr, mem_ptr_t<CellDmuxEsAttr> 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()); demuxerType2.GetAddr(), esFilterId.GetAddr(), esSpecificInfo_addr, esAttr.GetAddr());
if (!demuxerType2.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood()) if (!demuxerType2.IsGood() || !esFilterId.IsGood() || !esAttr.IsGood())
@ -741,7 +742,7 @@ int cellDmuxQueryEsAttr2(const mem_ptr_t<CellDmuxType2> demuxerType2, const mem_
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) 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; return CELL_DMUX_ERROR_FATAL;
} }
@ -760,7 +761,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t<CellCodecEsFilterId> esF
const mem_ptr_t<CellDmuxEsResource> esResourceInfo, const mem_ptr_t<CellDmuxEsCb> esCb, const mem_ptr_t<CellDmuxEsResource> esResourceInfo, const mem_ptr_t<CellDmuxEsCb> esCb,
const u32 esSpecificInfo_addr, mem32_t esHandle) 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(), "esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.GetAddr(), esResourceInfo.GetAddr(),
esCb.GetAddr(), esSpecificInfo_addr, esHandle.GetAddr()); esCb.GetAddr(), esSpecificInfo_addr, esHandle.GetAddr());
@ -771,7 +772,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t<CellCodecEsFilterId> esF
if (!Memory.IsGoodAddr(esSpecificInfo_addr, 12)) 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; return CELL_DMUX_ERROR_FATAL;
} }
@ -792,11 +793,11 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t<CellCodecEsFilterId> esF
esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2, esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2,
esCb->cbEsMsgFunc, esCb->cbArg_addr, esSpecificInfo_addr); esCb->cbEsMsgFunc, esCb->cbArg_addr, esSpecificInfo_addr);
u32 id = cellDmux.GetNewId(es); u32 id = cellDmux->GetNewId(es);
es->id = id; es->id = id;
esHandle = 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); demuxerHandle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, (u32)esCb->cbEsMsgFunc, es->cbArg, es->spec, id);
DemuxerTask task(dmuxEnableEs); DemuxerTask task(dmuxEnableEs);
@ -809,7 +810,7 @@ int cellDmuxEnableEs(u32 demuxerHandle, const mem_ptr_t<CellCodecEsFilterId> esF
int cellDmuxDisableEs(u32 esHandle) int cellDmuxDisableEs(u32 esHandle)
{ {
cellDmux.Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle); cellDmux->Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle);
ElementaryStream* es; ElementaryStream* es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -827,7 +828,7 @@ int cellDmuxDisableEs(u32 esHandle)
int cellDmuxResetEs(u32 esHandle) int cellDmuxResetEs(u32 esHandle)
{ {
cellDmux.Log("cellDmuxResetEs(esHandle=0x%x)", esHandle); cellDmux->Log("cellDmuxResetEs(esHandle=0x%x)", esHandle);
ElementaryStream* es; ElementaryStream* es;
if (!Emu.GetIdManager().GetIDData(esHandle, 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) 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()); esHandle, auInfo_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr());
ElementaryStream* es; 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) 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()); esHandle, auInfo_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr());
ElementaryStream* es; 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) 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()); esHandle, auInfoEx_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr());
ElementaryStream* es; 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) 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()); esHandle, auInfoEx_ptr.GetAddr(), auSpecificInfo_ptr.GetAddr());
ElementaryStream* es; ElementaryStream* es;
@ -957,7 +958,7 @@ int cellDmuxPeekAuEx(u32 esHandle, mem32_t auInfoEx_ptr, mem32_t auSpecificInfo_
int cellDmuxReleaseAu(u32 esHandle) int cellDmuxReleaseAu(u32 esHandle)
{ {
cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); cellDmux->Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle);
ElementaryStream* es; ElementaryStream* es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -974,7 +975,7 @@ int cellDmuxReleaseAu(u32 esHandle)
int cellDmuxFlushEs(u32 esHandle) int cellDmuxFlushEs(u32 esHandle)
{ {
cellDmux.Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle); cellDmux->Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle);
ElementaryStream* es; ElementaryStream* es;
if (!Emu.GetIdManager().GetIDData(esHandle, es)) if (!Emu.GetIdManager().GetIDData(esHandle, es))
@ -992,24 +993,24 @@ int cellDmuxFlushEs(u32 esHandle)
void cellDmux_init() void cellDmux_init()
{ {
cellDmux.AddFunc(0xa2d4189b, cellDmuxQueryAttr); cellDmux->AddFunc(0xa2d4189b, cellDmuxQueryAttr);
cellDmux.AddFunc(0x3f76e3cd, cellDmuxQueryAttr2); cellDmux->AddFunc(0x3f76e3cd, cellDmuxQueryAttr2);
cellDmux.AddFunc(0x68492de9, cellDmuxOpen); cellDmux->AddFunc(0x68492de9, cellDmuxOpen);
cellDmux.AddFunc(0xf6c23560, cellDmuxOpenEx); cellDmux->AddFunc(0xf6c23560, cellDmuxOpenEx);
cellDmux.AddFunc(0x11bc3a6c, cellDmuxOpen2); cellDmux->AddFunc(0x11bc3a6c, cellDmuxOpen2);
cellDmux.AddFunc(0x8c692521, cellDmuxClose); cellDmux->AddFunc(0x8c692521, cellDmuxClose);
cellDmux.AddFunc(0x04e7499f, cellDmuxSetStream); cellDmux->AddFunc(0x04e7499f, cellDmuxSetStream);
cellDmux.AddFunc(0x5d345de9, cellDmuxResetStream); cellDmux->AddFunc(0x5d345de9, cellDmuxResetStream);
cellDmux.AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone); cellDmux->AddFunc(0xccff1284, cellDmuxResetStreamAndWaitDone);
cellDmux.AddFunc(0x02170d1a, cellDmuxQueryEsAttr); cellDmux->AddFunc(0x02170d1a, cellDmuxQueryEsAttr);
cellDmux.AddFunc(0x52911bcf, cellDmuxQueryEsAttr2); cellDmux->AddFunc(0x52911bcf, cellDmuxQueryEsAttr2);
cellDmux.AddFunc(0x7b56dc3f, cellDmuxEnableEs); cellDmux->AddFunc(0x7b56dc3f, cellDmuxEnableEs);
cellDmux.AddFunc(0x05371c8d, cellDmuxDisableEs); cellDmux->AddFunc(0x05371c8d, cellDmuxDisableEs);
cellDmux.AddFunc(0x21d424f0, cellDmuxResetEs); cellDmux->AddFunc(0x21d424f0, cellDmuxResetEs);
cellDmux.AddFunc(0x42c716b5, cellDmuxGetAu); cellDmux->AddFunc(0x42c716b5, cellDmuxGetAu);
cellDmux.AddFunc(0x2750c5e0, cellDmuxPeekAu); cellDmux->AddFunc(0x2750c5e0, cellDmuxPeekAu);
cellDmux.AddFunc(0x2c9a5857, cellDmuxGetAuEx); cellDmux->AddFunc(0x2c9a5857, cellDmuxGetAuEx);
cellDmux.AddFunc(0x002e8da2, cellDmuxPeekAuEx); cellDmux->AddFunc(0x002e8da2, cellDmuxPeekAuEx);
cellDmux.AddFunc(0x24ea6474, cellDmuxReleaseAu); cellDmux->AddFunc(0x24ea6474, cellDmuxReleaseAu);
cellDmux.AddFunc(0xebb3b2bd, cellDmuxFlushEs); cellDmux->AddFunc(0xebb3b2bd, cellDmuxFlushEs);
} }

View file

@ -10,10 +10,11 @@
#include "cellFont.h" #include "cellFont.h"
#include "stblib/stb_truetype.h" #include "stblib/stb_truetype.h"
void cellFont_init(); //void cellFont_init();
void cellFont_load(); //void cellFont_load();
void cellFont_unload(); //void cellFont_unload();
Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload); //Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload);
Module *cellFont = nullptr;
// Font Set Types // Font Set Types
enum enum
@ -238,7 +239,7 @@ CCellFontInternal* s_fontInternalInstance = nullptr;
// Functions // Functions
int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig> config) int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig> 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) if (s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_ALREADY_INITIALIZED; return CELL_FONT_ERROR_ALREADY_INITIALIZED;
@ -249,7 +250,7 @@ int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig>
if (config->FileCache.size < 24) if (config->FileCache.size < 24)
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
if (config->flags != 0) 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_addr = config->FileCache.buffer_addr;
s_fontInternalInstance->m_buffer_size = config->FileCache.size; s_fontInternalInstance->m_buffer_size = config->FileCache.size;
@ -267,7 +268,7 @@ int cellFontGetRevisionFlags(mem64_t revisionFlags)
int cellFontInit(mem_ptr_t<CellFontConfig> config) int cellFontInit(mem_ptr_t<CellFontConfig> config)
{ {
cellFont.Log("cellFontInit(config=0x%x)", config.GetAddr()); cellFont->Log("cellFontInit(config=0x%x)", config.GetAddr());
MemoryAllocator<u64> revisionFlags = 0; MemoryAllocator<u64> revisionFlags = 0;
cellFontGetRevisionFlags(revisionFlags.GetAddr()); cellFontGetRevisionFlags(revisionFlags.GetAddr());
@ -276,7 +277,7 @@ int cellFontInit(mem_ptr_t<CellFontConfig> config)
int cellFontEnd() int cellFontEnd()
{ {
cellFont.Log("cellFontEnd()"); cellFont->Log("cellFontEnd()");
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
@ -287,14 +288,14 @@ int cellFontEnd()
s32 cellFontSetFontsetOpenMode(u32 openMode) s32 cellFontSetFontsetOpenMode(u32 openMode)
{ {
cellFont.Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode); cellFont->Log("cellFontSetFontsetOpenMode(openMode=0x%x)", openMode);
UNIMPLEMENTED_FUNC(cellFont); UNIMPLEMENTED_FUNC(cellFont);
return CELL_FONT_OK; return CELL_FONT_OK;
} }
int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, mem_ptr_t<CellFont> font) int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, mem_ptr_t<CellFont> 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()); library.GetAddr(), fontAddr, fontSize, subNum, uniqueId, font.GetAddr());
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
@ -316,7 +317,7 @@ int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32
int cellFontOpenFontFile(mem_ptr_t<CellFontLibrary> library, mem8_ptr_t fontPath, u32 subNum, s32 uniqueId, mem_ptr_t<CellFont> font) int cellFontOpenFontFile(mem_ptr_t<CellFontLibrary> library, mem8_ptr_t fontPath, u32 subNum, s32 uniqueId, mem_ptr_t<CellFont> font)
{ {
std::string fp(fontPath.GetString()); 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()); library.GetAddr(), fp.c_str(), subNum, uniqueId, font.GetAddr());
vfsFile f(fp); vfsFile f(fp);
@ -333,7 +334,7 @@ int cellFontOpenFontFile(mem_ptr_t<CellFontLibrary> library, mem8_ptr_t fontPath
int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontType> fontType, mem_ptr_t<CellFont> font) int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontType> fontType, mem_ptr_t<CellFont> 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()); library.GetAddr(), fontType.GetAddr(), font.GetAddr());
if (!library.IsGood() || !fontType.IsGood() || !font.IsGood()) if (!library.IsGood() || !fontType.IsGood() || !font.IsGood())
@ -341,7 +342,7 @@ int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontTy
if (!s_fontInternalInstance->m_bInitialized) if (!s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_UNINITIALIZED; return CELL_FONT_ERROR_UNINITIALIZED;
if (fontType->map != CELL_FONT_MAP_UNICODE) if (fontType->map != CELL_FONT_MAP_UNICODE)
cellFont.Warning("cellFontOpenFontset: Only Unicode is supported"); cellFont->Warning("cellFontOpenFontset: Only Unicode is supported");
std::string file; std::string file;
switch((u32)fontType->type) switch((u32)fontType->type)
@ -400,12 +401,12 @@ int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontTy
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_RSANS2_SET:
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_YG_DFHEI5_VAGR2_SET:
case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET: case CELL_FONT_TYPE_SEURAT_CAPIE_MARU_GOTHIC_VAGR2_SET:
cellFont.Warning("cellFontOpenFontset: fontType->type = %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"; file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF";
break; break;
default: 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; return CELL_FONT_ERROR_NO_SUPPORT_FONTSET;
} }
@ -419,7 +420,7 @@ int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontTy
int cellFontOpenFontInstance(mem_ptr_t<CellFont> openedFont, mem_ptr_t<CellFont> font) int cellFontOpenFontInstance(mem_ptr_t<CellFont> openedFont, mem_ptr_t<CellFont> 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()) if (!openedFont.IsGood() || !font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -436,14 +437,14 @@ int cellFontOpenFontInstance(mem_ptr_t<CellFont> openedFont, mem_ptr_t<CellFont>
s32 cellFontSetFontOpenMode(u32 openMode) s32 cellFontSetFontOpenMode(u32 openMode)
{ {
cellFont.Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode); cellFont->Log("cellFontSetFontOpenMode(openMode=0x%x)", openMode);
UNIMPLEMENTED_FUNC(cellFont); UNIMPLEMENTED_FUNC(cellFont);
return CELL_FONT_OK; return CELL_FONT_OK;
} }
int cellFontCreateRenderer(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontRendererConfig> config, mem_ptr_t<CellFontRenderer> Renderer) int cellFontCreateRenderer(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontRendererConfig> config, mem_ptr_t<CellFontRenderer> 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()); library.GetAddr(), config.GetAddr(), Renderer.GetAddr());
if (!library.IsGood() || !config.IsGood() || !Renderer.IsGood()) if (!library.IsGood() || !config.IsGood() || !Renderer.IsGood())
@ -458,7 +459,7 @@ int cellFontCreateRenderer(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFon
void cellFontRenderSurfaceInit(mem_ptr_t<CellFontRenderSurface> surface, u32 buffer_addr, s32 bufferWidthByte, s32 pixelSizeByte, s32 w, s32 h) void cellFontRenderSurfaceInit(mem_ptr_t<CellFontRenderSurface> 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.GetAddr(), buffer_addr, bufferWidthByte, pixelSizeByte, w, h);
surface->buffer_addr = buffer_addr; surface->buffer_addr = buffer_addr;
@ -473,7 +474,7 @@ void cellFontRenderSurfaceInit(mem_ptr_t<CellFontRenderSurface> surface, u32 buf
void cellFontRenderSurfaceSetScissor(mem_ptr_t<CellFontRenderSurface> surface, s32 x0, s32 y0, s32 w, s32 h) void cellFontRenderSurfaceSetScissor(mem_ptr_t<CellFontRenderSurface> 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.GetAddr(), x0, y0, w, h);
surface->Scissor.x0 = x0; surface->Scissor.x0 = x0;
@ -486,7 +487,7 @@ int cellFontSetScalePixel(mem_ptr_t<CellFont> font, float w, float h)
{ {
w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
h = GetCurrentPPUThread().FPR[2]; // 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()) if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -498,7 +499,7 @@ int cellFontSetScalePixel(mem_ptr_t<CellFont> font, float w, float h)
int cellFontGetHorizontalLayout(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontHorizontalLayout> layout) int cellFontGetHorizontalLayout(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontHorizontalLayout> 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()); font.GetAddr(), layout.GetAddr());
if (!font.IsGood() || !layout.IsGood()) if (!font.IsGood() || !layout.IsGood())
@ -516,7 +517,7 @@ int cellFontGetHorizontalLayout(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontHori
int cellFontBindRenderer(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontRenderer> renderer) int cellFontBindRenderer(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontRenderer> 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()); font.GetAddr(), renderer.GetAddr());
if (!font.IsGood() || !renderer.IsGood()) if (!font.IsGood() || !renderer.IsGood())
@ -530,7 +531,7 @@ int cellFontBindRenderer(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontRenderer> r
int cellFontUnbindRenderer(mem_ptr_t<CellFont> font) int cellFontUnbindRenderer(mem_ptr_t<CellFont> font)
{ {
cellFont.Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr()); cellFont->Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr());
if (!font.IsGood()) if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -551,7 +552,7 @@ int cellFontSetupRenderScalePixel(mem_ptr_t<CellFont> font, float w, float h)
{ {
w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments w = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
h = GetCurrentPPUThread().FPR[2]; // 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()) if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -564,7 +565,7 @@ int cellFontSetupRenderScalePixel(mem_ptr_t<CellFont> font, float w, float h)
int cellFontGetRenderCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<CellFontGlyphMetrics> metrics) int cellFontGetRenderCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<CellFontGlyphMetrics> 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()); font.GetAddr(), code, metrics.GetAddr());
if (!font.IsGood() || !metrics.IsGood()) if (!font.IsGood() || !metrics.IsGood())
@ -580,7 +581,7 @@ int cellFontRenderCharGlyphImage(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<C
{ {
x = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments x = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
y = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments y = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments
cellFont.Log("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)", cellFont->Log("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()); font.GetAddr(), code, surface.GetAddr(), x, y, metrics.GetAddr(), transInfo.GetAddr());
if (!font.IsGood() || !surface.IsGood() || !metrics.IsGood() || !transInfo.IsGood()) if (!font.IsGood() || !surface.IsGood() || !metrics.IsGood() || !transInfo.IsGood())
@ -627,7 +628,7 @@ int cellFontEndLibrary()
int cellFontSetEffectSlant(mem_ptr_t<CellFont> font, float slantParam) int cellFontSetEffectSlant(mem_ptr_t<CellFont> font, float slantParam)
{ {
slantParam = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments 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) if (!font.IsGood() || slantParam < -1.0 || slantParam > 1.0)
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -638,7 +639,7 @@ int cellFontSetEffectSlant(mem_ptr_t<CellFont> font, float slantParam)
int cellFontGetEffectSlant(mem_ptr_t<CellFont> font, mem32_t slantParam) int cellFontGetEffectSlant(mem_ptr_t<CellFont> 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()) if (!font.IsGood() || !slantParam.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -649,7 +650,7 @@ int cellFontGetEffectSlant(mem_ptr_t<CellFont> font, mem32_t slantParam)
int cellFontGetFontIdCode(mem_ptr_t<CellFont> font, u32 code, mem32_t fontId, mem32_t fontCode) int cellFontGetFontIdCode(mem_ptr_t<CellFont> 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()); font.GetAddr(), code, fontId.GetAddr(), fontCode.GetAddr());
if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used
@ -661,7 +662,7 @@ int cellFontGetFontIdCode(mem_ptr_t<CellFont> font, u32 code, mem32_t fontId, me
int cellFontCloseFont(mem_ptr_t<CellFont> font) int cellFontCloseFont(mem_ptr_t<CellFont> font)
{ {
cellFont.Warning("cellFontCloseFont(font_addr=0x%x)", font.GetAddr()); cellFont->Warning("cellFontCloseFont(font_addr=0x%x)", font.GetAddr());
if (!font.IsGood()) if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER; return CELL_FONT_ERROR_INVALID_PARAMETER;
@ -676,7 +677,7 @@ int cellFontCloseFont(mem_ptr_t<CellFont> font)
int cellFontGetCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<CellFontGlyphMetrics> metrics) int cellFontGetCharGlyphMetrics(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<CellFontGlyphMetrics> 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()); font.GetAddr(), code, metrics.GetAddr());
if (!font.IsGood() || metrics.IsGood()) if (!font.IsGood() || metrics.IsGood())
@ -816,7 +817,7 @@ int cellFontDeleteGlyph()
int cellFontExtend(u32 a1, u32 a2, u32 a3) 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) //In a test I did: a1=0xcfe00000, a2=0x0, a3=(pointer to something)
if (a1 == 0xcfe00000) if (a1 == 0xcfe00000)
{ {
@ -854,56 +855,56 @@ int cellFontGetCharGlyphMetricsVertical()
void cellFont_init() void cellFont_init()
{ {
cellFont.AddFunc(0x25c107e6, cellFontInit); cellFont->AddFunc(0x25c107e6, cellFontInit);
cellFont.AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode); cellFont->AddFunc(0x6bf6f832, cellFontSetFontsetOpenMode);
cellFont.AddFunc(0x6cfada83, cellFontSetFontOpenMode); cellFont->AddFunc(0x6cfada83, cellFontSetFontOpenMode);
cellFont.AddFunc(0x042e74e3, cellFontCreateRenderer); cellFont->AddFunc(0x042e74e3, cellFontCreateRenderer);
cellFont.AddFunc(0x1387c45c, cellFontGetHorizontalLayout); cellFont->AddFunc(0x1387c45c, cellFontGetHorizontalLayout);
cellFont.AddFunc(0x21ebb248, cellFontDestroyRenderer); cellFont->AddFunc(0x21ebb248, cellFontDestroyRenderer);
cellFont.AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel); cellFont->AddFunc(0x227e1e3c, cellFontSetupRenderScalePixel);
cellFont.AddFunc(0x29329541, cellFontOpenFontInstance); cellFont->AddFunc(0x29329541, cellFontOpenFontInstance);
cellFont.AddFunc(0x297f0e93, cellFontSetScalePixel); cellFont->AddFunc(0x297f0e93, cellFontSetScalePixel);
cellFont.AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics); cellFont->AddFunc(0x2da9fd9d, cellFontGetRenderCharGlyphMetrics);
cellFont.AddFunc(0x40d40544, cellFontEndLibrary); cellFont->AddFunc(0x40d40544, cellFontEndLibrary);
cellFont.AddFunc(0x66a23100, cellFontBindRenderer); cellFont->AddFunc(0x66a23100, cellFontBindRenderer);
cellFont.AddFunc(0x7ab47f7e, cellFontEnd); cellFont->AddFunc(0x7ab47f7e, cellFontEnd);
cellFont.AddFunc(0x8657c8f5, cellFontSetEffectSlant); cellFont->AddFunc(0x8657c8f5, cellFontSetEffectSlant);
cellFont.AddFunc(0xe16e679a, cellFontGetEffectSlant); cellFont->AddFunc(0xe16e679a, cellFontGetEffectSlant);
cellFont.AddFunc(0x88be4799, cellFontRenderCharGlyphImage); cellFont->AddFunc(0x88be4799, cellFontRenderCharGlyphImage);
cellFont.AddFunc(0x90b9465e, cellFontRenderSurfaceInit); cellFont->AddFunc(0x90b9465e, cellFontRenderSurfaceInit);
cellFont.AddFunc(0x98ac5524, cellFontGetFontIdCode); cellFont->AddFunc(0x98ac5524, cellFontGetFontIdCode);
cellFont.AddFunc(0xa885cc9b, cellFontOpenFontset); cellFont->AddFunc(0xa885cc9b, cellFontOpenFontset);
cellFont.AddFunc(0xb276f1f6, cellFontCloseFont); cellFont->AddFunc(0xb276f1f6, cellFontCloseFont);
cellFont.AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor); cellFont->AddFunc(0xb422b005, cellFontRenderSurfaceSetScissor);
cellFont.AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics); cellFont->AddFunc(0xd8eaee9f, cellFontGetCharGlyphMetrics);
cellFont.AddFunc(0xf03dcc29, cellFontInitializeWithRevision); cellFont->AddFunc(0xf03dcc29, cellFontInitializeWithRevision);
cellFont.AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA); cellFont->AddFunc(0x061049ad, cellFontGraphicsSetFontRGBA);
cellFont.AddFunc(0x073fa321, cellFontOpenFontsetOnMemory); cellFont->AddFunc(0x073fa321, cellFontOpenFontsetOnMemory);
cellFont.AddFunc(0x0a7306a4, cellFontOpenFontFile); cellFont->AddFunc(0x0a7306a4, cellFontOpenFontFile);
cellFont.AddFunc(0x16322df1, cellFontGraphicsSetScalePixel); cellFont->AddFunc(0x16322df1, cellFontGraphicsSetScalePixel);
cellFont.AddFunc(0x2388186c, cellFontGraphicsGetScalePixel); cellFont->AddFunc(0x2388186c, cellFontGraphicsGetScalePixel);
cellFont.AddFunc(0x25253fe4, cellFontSetEffectWeight); cellFont->AddFunc(0x25253fe4, cellFontSetEffectWeight);
cellFont.AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph); cellFont->AddFunc(0x53f529fe, cellFontGlyphSetupVertexesGlyph);
cellFont.AddFunc(0x698897f8, cellFontGetVerticalLayout); cellFont->AddFunc(0x698897f8, cellFontGetVerticalLayout);
cellFont.AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical); cellFont->AddFunc(0x700e6223, cellFontGetRenderCharGlyphMetricsVertical);
cellFont.AddFunc(0x70f3e728, cellFontSetScalePoint); cellFont->AddFunc(0x70f3e728, cellFontSetScalePoint);
cellFont.AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant); cellFont->AddFunc(0x78d05e08, cellFontSetupRenderEffectSlant);
cellFont.AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA); cellFont->AddFunc(0x7c83bc15, cellFontGraphicsSetLineRGBA);
cellFont.AddFunc(0x87bd650f, cellFontGraphicsSetDrawType); cellFont->AddFunc(0x87bd650f, cellFontGraphicsSetDrawType);
cellFont.AddFunc(0x8a35c887, cellFontEndGraphics); cellFont->AddFunc(0x8a35c887, cellFontEndGraphics);
cellFont.AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext); cellFont->AddFunc(0x970d4c22, cellFontGraphicsSetupDrawContext);
cellFont.AddFunc(0x9e19072b, cellFontOpenFontMemory); cellFont->AddFunc(0x9e19072b, cellFontOpenFontMemory);
cellFont.AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight); cellFont->AddFunc(0xa6dc25d1, cellFontSetupRenderEffectWeight);
cellFont.AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance); cellFont->AddFunc(0xa8fae920, cellFontGlyphGetOutlineControlDistance);
cellFont.AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize); cellFont->AddFunc(0xb4d112af, cellFontGlyphGetVertexesGlyphSize);
cellFont.AddFunc(0xc17259de, cellFontGenerateCharGlyph); cellFont->AddFunc(0xc17259de, cellFontGenerateCharGlyph);
cellFont.AddFunc(0xd62f5d76, cellFontDeleteGlyph); cellFont->AddFunc(0xd62f5d76, cellFontDeleteGlyph);
cellFont.AddFunc(0xdee0836c, cellFontExtend); cellFont->AddFunc(0xdee0836c, cellFontExtend);
cellFont.AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical); cellFont->AddFunc(0xe857a0ca, cellFontRenderCharGlyphImageVertical);
cellFont.AddFunc(0xfb3341ba, cellFontSetResolutionDpi); cellFont->AddFunc(0xfb3341ba, cellFontSetResolutionDpi);
cellFont.AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical); cellFont->AddFunc(0xfe9a6dd7, cellFontGetCharGlyphMetricsVertical);
cellFont.AddFunc(0xf16379fa, cellFontUnbindRenderer); cellFont->AddFunc(0xf16379fa, cellFontUnbindRenderer);
cellFont.AddFunc(0xb015a84e, cellFontGetRevisionFlags); cellFont->AddFunc(0xb015a84e, cellFontGetRevisionFlags);
} }
void cellFont_load() void cellFont_load()

View file

@ -8,10 +8,11 @@
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
#include "cellFont.h" #include "cellFont.h"
void cellFontFT_init(); //void cellFontFT_init();
void cellFontFT_load(); //void cellFontFT_load();
void cellFontFT_unload(); //void cellFontFT_unload();
Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload); //Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload);
extern Module *cellFontFT = nullptr;
struct CellFontLibraryConfigFT struct CellFontLibraryConfigFT
{ {
@ -44,7 +45,7 @@ CCellFontFTInternal* s_fontFtInternalInstance = nullptr;
int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontLibraryConfigFT> config, u32 lib_addr_addr) int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontLibraryConfigFT> 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); revisionFlags, config.GetAddr(), lib_addr_addr);
if (!config.IsGood() || !Memory.IsGoodAddr(lib_addr_addr)) if (!config.IsGood() || !Memory.IsGoodAddr(lib_addr_addr))
@ -71,9 +72,9 @@ int cellFontFTGetInitializedRevisionFlags()
void cellFontFT_init() void cellFontFT_init()
{ {
cellFontFT.AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision); cellFontFT->AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision);
cellFontFT.AddFunc(0xec89a187, cellFontFTGetRevisionFlags); cellFontFT->AddFunc(0xec89a187, cellFontFTGetRevisionFlags);
cellFontFT.AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags); cellFontFT->AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags);
} }
void cellFontFT_load() void cellFontFT_load()

View file

@ -10,8 +10,9 @@
#include "Loader/PSF.h" #include "Loader/PSF.h"
void cellGame_init(); //void cellGame_init();
Module cellGame(0x003e, cellGame_init); //Module cellGame(0x003e, cellGame_init);
extern Module *cellGame = nullptr;
// Return Codes // Return Codes
enum enum
@ -118,12 +119,12 @@ struct CellGameContentSize
int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameContentSize> size, mem_list_ptr_t<u8> dirName) int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameContentSize> size, mem_list_ptr_t<u8> 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()); type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());
if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood()) 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; return CELL_GAME_ERROR_PARAM;
} }
@ -159,7 +160,7 @@ int cellGameDataCheck()
int cellGameContentPermit(mem_list_ptr_t<u8> contentInfoPath, mem_list_ptr_t<u8> usrdirPath) int cellGameContentPermit(mem_list_ptr_t<u8> contentInfoPath, mem_list_ptr_t<u8> 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()); contentInfoPath.GetAddr(), usrdirPath.GetAddr());
if (!contentInfoPath.IsGood() || !usrdirPath.IsGood()) if (!contentInfoPath.IsGood() || !usrdirPath.IsGood())
@ -192,7 +193,7 @@ int cellGameDeleteGameData()
int cellGameGetParamInt(u32 id, mem32_t value) 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()) if(!value.IsGood())
return CELL_GAME_ERROR_PARAM; 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) 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)) if(!Memory.IsGoodAddr(buf_addr))
return CELL_GAME_ERROR_PARAM; return CELL_GAME_ERROR_PARAM;
@ -293,7 +294,7 @@ int cellGameGetLocalWebContentPath()
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr) 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)) if (Memory.IsGoodAddr(dirName_addr))
return CELL_GAME_ERROR_PARAM; 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", std::string errorMsg = fmt::Format("%s\nSpace needed: %d KB\nDirectory name: %s",
errorName.c_str(), errNeedSizeKB, dirName); errorName.c_str(), errNeedSizeKB, dirName);
wxMessageBox(fmt::FromUTF8(errorMsg), wxGetApp().GetAppName(), wxICON_ERROR | wxOK); rMessageBox(errorMsg, rGetApp().GetAppName(), rICON_ERROR | rOK);
return CELL_OK; return CELL_OK;
} }
@ -333,25 +334,25 @@ void cellGame_init()
{ {
// (TODO: Disc Exchange functions missing) // (TODO: Disc Exchange functions missing)
cellGame.AddFunc(0xf52639ea, cellGameBootCheck); cellGame->AddFunc(0xf52639ea, cellGameBootCheck);
cellGame.AddFunc(0xce4374f6, cellGamePatchCheck); cellGame->AddFunc(0xce4374f6, cellGamePatchCheck);
cellGame.AddFunc(0xdb9819f3, cellGameDataCheck); cellGame->AddFunc(0xdb9819f3, cellGameDataCheck);
cellGame.AddFunc(0x70acec67, cellGameContentPermit); cellGame->AddFunc(0x70acec67, cellGameContentPermit);
cellGame.AddFunc(0x42a2e133, cellGameCreateGameData); cellGame->AddFunc(0x42a2e133, cellGameCreateGameData);
cellGame.AddFunc(0xb367c6e3, cellGameDeleteGameData); cellGame->AddFunc(0xb367c6e3, cellGameDeleteGameData);
cellGame.AddFunc(0xb7a45caf, cellGameGetParamInt); cellGame->AddFunc(0xb7a45caf, cellGameGetParamInt);
//cellGame.AddFunc(, cellGameSetParamInt); //cellGame->AddFunc(, cellGameSetParamInt);
cellGame.AddFunc(0x3a5d726a, cellGameGetParamString); cellGame->AddFunc(0x3a5d726a, cellGameGetParamString);
cellGame.AddFunc(0xdaa5cd20, cellGameSetParamString); cellGame->AddFunc(0xdaa5cd20, cellGameSetParamString);
cellGame.AddFunc(0xef9d42d5, cellGameGetSizeKB); cellGame->AddFunc(0xef9d42d5, cellGameGetSizeKB);
cellGame.AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath); cellGame->AddFunc(0x2a8e6b92, cellGameGetDiscContentInfoUpdatePath);
cellGame.AddFunc(0xa80bf223, cellGameGetLocalWebContentPath); cellGame->AddFunc(0xa80bf223, cellGameGetLocalWebContentPath);
cellGame.AddFunc(0xb0a1f8c6, cellGameContentErrorDialog); cellGame->AddFunc(0xb0a1f8c6, cellGameContentErrorDialog);
cellGame.AddFunc(0xd24e3928, cellGameThemeInstall); cellGame->AddFunc(0xd24e3928, cellGameThemeInstall);
cellGame.AddFunc(0x87406734, cellGameThemeInstallFromBuffer); cellGame->AddFunc(0x87406734, cellGameThemeInstallFromBuffer);
//cellGame.AddFunc(, CellGameThemeInstallCallback); //cellGame->AddFunc(, CellGameThemeInstallCallback);
} }

View file

@ -8,10 +8,11 @@
#include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SysCalls.h"
#include "Emu/GS/GCM.h" #include "Emu/GS/GCM.h"
void cellGcmSys_init(); //void cellGcmSys_init();
void cellGcmSys_load(); //void cellGcmSys_load();
void cellGcmSys_unload(); //void cellGcmSys_unload();
Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload); //Module cellGcmSys(0x0010, cellGcmSys_init, cellGcmSys_load, cellGcmSys_unload);
extern Module *cellGcmSys = nullptr;
u32 local_size = 0; u32 local_size = 0;
u32 local_addr = 0; u32 local_addr = 0;
@ -67,17 +68,17 @@ u32 map_offset_pos = 0;
u32 cellGcmGetLabelAddress(u8 index) u32 cellGcmGetLabelAddress(u8 index)
{ {
cellGcmSys.Log("cellGcmGetLabelAddress(index=%d)", index); cellGcmSys->Log("cellGcmGetLabelAddress(index=%d)", index);
return Memory.RSXCMDMem.GetStartAddr() + 0x10 * index; return Memory.RSXCMDMem.GetStartAddr() + 0x10 * index;
} }
u32 cellGcmGetReportDataAddressLocation(u32 index, u32 location) 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 (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong local index (%d)", index);
return 0; return 0;
} }
return Memory.RSXFBMem.GetStartAddr() + index * 0x10; return Memory.RSXFBMem.GetStartAddr() + index * 0x10;
@ -85,23 +86,23 @@ u32 cellGcmGetReportDataAddressLocation(u32 index, u32 location)
if (location == CELL_GCM_LOCATION_MAIN) { if (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024*1024) { if (index >= 1024*1024) {
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index); cellGcmSys->Error("cellGcmGetReportDataAddressLocation: Wrong main index (%d)", index);
return 0; return 0;
} }
// TODO: It seems m_report_main_addr is not initialized // TODO: It seems m_report_main_addr is not initialized
return Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10; 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; return 0;
} }
u64 cellGcmGetTimeStamp(u32 index) u64 cellGcmGetTimeStamp(u32 index)
{ {
cellGcmSys.Log("cellGcmGetTimeStamp(index=%d)", index); cellGcmSys->Log("cellGcmGetTimeStamp(index=%d)", index);
if (index >= 2048) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetTimeStamp: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetTimeStamp: Wrong local index (%d)", index);
return 0; return 0;
} }
return Memory.Read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); return Memory.Read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10);
@ -121,10 +122,10 @@ int cellGcmGetNotifyDataAddress()
u32 cellGcmGetReport(u32 type, u32 index) 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) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetReport: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetReport: Wrong local index (%d)", index);
return 0; return 0;
} }
// TODO: What does the argument type do? // TODO: What does the argument type do?
@ -133,10 +134,10 @@ u32 cellGcmGetReport(u32 type, u32 index)
u32 cellGcmGetReportDataAddress(u32 index) u32 cellGcmGetReportDataAddress(u32 index)
{ {
cellGcmSys.Warning("cellGcmGetReportDataAddress(index=%d)", index); cellGcmSys->Warning("cellGcmGetReportDataAddress(index=%d)", index);
if (index >= 2048) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetReportDataAddress: Wrong local index (%d)", index);
return 0; return 0;
} }
return Memory.RSXFBMem.GetStartAddr() + index * 0x10; return Memory.RSXFBMem.GetStartAddr() + index * 0x10;
@ -144,11 +145,11 @@ u32 cellGcmGetReportDataAddress(u32 index)
u32 cellGcmGetReportDataLocation(u32 index, u32 location) 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 (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetReportDataLocation: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetReportDataLocation: Wrong local index (%d)", index);
return 0; return 0;
} }
return Memory.Read32(Memory.RSXFBMem.GetStartAddr() + index * 0x10 + 0x8); 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 (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024*1024) { if (index >= 1024*1024) {
cellGcmSys.Error("cellGcmGetReportDataLocation: Wrong main index (%d)", index); cellGcmSys->Error("cellGcmGetReportDataLocation: Wrong main index (%d)", index);
return 0; return 0;
} }
// TODO: It seems m_report_main_addr is not initialized // TODO: It seems m_report_main_addr is not initialized
return Memory.Read32(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10 + 0x8); 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; return 0;
} }
u64 cellGcmGetTimeStampLocation(u32 index, u32 location) 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 (location == CELL_GCM_LOCATION_LOCAL) {
if (index >= 2048) { if (index >= 2048) {
cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index); cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong local index (%d)", index);
return 0; return 0;
} }
return Memory.Read64(Memory.RSXFBMem.GetStartAddr() + index * 0x10); 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 (location == CELL_GCM_LOCATION_MAIN) {
if (index >= 1024*1024) { if (index >= 1024*1024) {
cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index); cellGcmSys->Error("cellGcmGetTimeStampLocation: Wrong main index (%d)", index);
return 0; return 0;
} }
// TODO: It seems m_report_main_addr is not initialized // TODO: It seems m_report_main_addr is not initialized
return Memory.Read64(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10); 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; return 0;
} }
@ -198,32 +199,32 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
u32 cellGcmGetControlRegister() u32 cellGcmGetControlRegister()
{ {
cellGcmSys.Log("cellGcmGetControlRegister()"); cellGcmSys->Log("cellGcmGetControlRegister()");
return gcm_info.control_addr; return gcm_info.control_addr;
} }
u32 cellGcmGetDefaultCommandWordSize() u32 cellGcmGetDefaultCommandWordSize()
{ {
cellGcmSys.Log("cellGcmGetDefaultCommandWordSize()"); cellGcmSys->Log("cellGcmGetDefaultCommandWordSize()");
return 0x400; return 0x400;
} }
u32 cellGcmGetDefaultSegmentWordSize() u32 cellGcmGetDefaultSegmentWordSize()
{ {
cellGcmSys.Log("cellGcmGetDefaultSegmentWordSize()"); cellGcmSys->Log("cellGcmGetDefaultSegmentWordSize()");
return 0x100; return 0x100;
} }
int cellGcmInitDefaultFifoMode(s32 mode) int cellGcmInitDefaultFifoMode(s32 mode)
{ {
cellGcmSys.Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode); cellGcmSys->Warning("cellGcmInitDefaultFifoMode(mode=%d)", mode);
return CELL_OK; return CELL_OK;
} }
int cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize) 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; return CELL_OK;
} }
@ -233,11 +234,11 @@ int cellGcmSetDefaultFifoSize(u32 bufferSize, u32 segmentSize)
int cellGcmBindTile(u8 index) int cellGcmBindTile(u8 index)
{ {
cellGcmSys.Warning("cellGcmBindTile(index=%d)", index); cellGcmSys->Warning("cellGcmBindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -249,11 +250,11 @@ int cellGcmBindTile(u8 index)
int cellGcmBindZcull(u8 index) int cellGcmBindZcull(u8 index)
{ {
cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index); cellGcmSys->Warning("cellGcmBindZcull(index=%d)", index);
if (index >= RSXThread::m_zculls_count) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -265,11 +266,11 @@ int cellGcmBindZcull(u8 index)
int cellGcmGetConfiguration(mem_ptr_t<CellGcmConfig> config) int cellGcmGetConfiguration(mem_ptr_t<CellGcmConfig> config)
{ {
cellGcmSys.Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr()); cellGcmSys->Log("cellGcmGetConfiguration(config_addr=0x%x)", config.GetAddr());
if (!config.IsGood()) if (!config.IsGood())
{ {
cellGcmSys.Error("cellGcmGetConfiguration : CELL_EFAULT"); cellGcmSys->Error("cellGcmGetConfiguration : CELL_EFAULT");
return CELL_EFAULT; return CELL_EFAULT;
} }
@ -280,15 +281,14 @@ int cellGcmGetConfiguration(mem_ptr_t<CellGcmConfig> config)
int cellGcmGetFlipStatus() int cellGcmGetFlipStatus()
{ {
cellGcmSys.Log("cellGcmGetFlipStatus()"); cellGcmSys->Log("cellGcmGetFlipStatus()");
return Emu.GetGSManager().GetRender().m_flip_status; return Emu.GetGSManager().GetRender().m_flip_status;
} }
u32 cellGcmGetTiledPitchSize(u32 size) u32 cellGcmGetTiledPitchSize(u32 size)
{ {
cellGcmSys.Warning("cellGcmGetTiledPitchSize(size=%d)", size); cellGcmSys->Warning("cellGcmGetTiledPitchSize(size=%d)", size);
// TODO: // TODO:
return size; return size;
@ -296,10 +296,10 @@ u32 cellGcmGetTiledPitchSize(u32 size)
int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) 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()) if(!cellGcmSys->IsLoaded())
cellGcmSys.Load(); cellGcmSys->Load();
if(!local_size && !local_addr) 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); 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(); InitOffsetTable();
Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x10000000/*256MB*/));//TODO: implement allocateAdressSpace in memoryBase Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x10000000/*256MB*/));//TODO: implement allocateAdressSpace in memoryBase
if(cellGcmMapEaIoAddress(ioAddress, 0, ioSize) != CELL_OK) if(cellGcmMapEaIoAddress(ioAddress, 0, ioSize) != CELL_OK)
{ {
Memory.MemoryBlocks.pop_back(); Memory.MemoryBlocks.pop_back();
cellGcmSys.Error("cellGcmInit : CELL_GCM_ERROR_FAILURE"); cellGcmSys->Error("cellGcmInit : CELL_GCM_ERROR_FAILURE");
return 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() int cellGcmResetFlipStatus()
{ {
cellGcmSys.Log("cellGcmResetFlipStatus()"); cellGcmSys->Log("cellGcmResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING; Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING;
@ -372,7 +372,7 @@ int cellGcmResetFlipStatus()
int cellGcmSetDebugOutputLevel(int level) int cellGcmSetDebugOutputLevel(int level)
{ {
cellGcmSys.Warning("cellGcmSetDebugOutputLevel(level=%d)", level); cellGcmSys->Warning("cellGcmSetDebugOutputLevel(level=%d)", level);
switch (level) switch (level)
{ {
@ -390,11 +390,11 @@ int cellGcmSetDebugOutputLevel(int level)
int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height) 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) if (id > 7)
{ {
cellGcmSys.Error("cellGcmSetDisplayBuffer : CELL_EINVAL"); cellGcmSys->Error("cellGcmSetDisplayBuffer : CELL_EINVAL");
return 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<CellGcmContextData> ctxt, u32 id) int cellGcmSetFlip(mem_ptr_t<CellGcmContextData> 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); int res = cellGcmSetPrepareFlip(ctxt, id);
return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK; return res < 0 ? CELL_GCM_ERROR_FAILURE : CELL_OK;
@ -423,11 +423,11 @@ int cellGcmSetFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
int cellGcmSetFlipHandler(u32 handler_addr) 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)) if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
{ {
cellGcmSys.Error("cellGcmSetFlipHandler : CELL_EFAULT"); cellGcmSys->Error("cellGcmSetFlipHandler : CELL_EFAULT");
return CELL_EFAULT; return CELL_EFAULT;
} }
@ -437,7 +437,7 @@ int cellGcmSetFlipHandler(u32 handler_addr)
int cellGcmSetFlipMode(u32 mode) int cellGcmSetFlipMode(u32 mode)
{ {
cellGcmSys.Warning("cellGcmSetFlipMode(mode=%d)", mode); cellGcmSys->Warning("cellGcmSetFlipMode(mode=%d)", mode);
switch (mode) switch (mode)
{ {
@ -456,18 +456,18 @@ int cellGcmSetFlipMode(u32 mode)
void cellGcmSetFlipStatus() void cellGcmSetFlipStatus()
{ {
cellGcmSys.Warning("cellGcmSetFlipStatus()"); cellGcmSys->Warning("cellGcmSetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 0; Emu.GetGSManager().GetRender().m_flip_status = 0;
} }
int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id) int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> 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) if(id >= 8)
{ {
cellGcmSys.Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE"); cellGcmSys->Error("cellGcmSetPrepareFlip : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -508,7 +508,7 @@ int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
int cellGcmSetSecondVFrequency(u32 freq) int cellGcmSetSecondVFrequency(u32 freq)
{ {
cellGcmSys.Warning("cellGcmSetSecondVFrequency(level=%d)", freq); cellGcmSys->Warning("cellGcmSetSecondVFrequency(level=%d)", freq);
switch (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) 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); index, location, offset, size, pitch, comp, base, bank);
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
if (offset & 0xffff || size & 0xffff || pitch & 0xf) 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; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) 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; return CELL_GCM_ERROR_INVALID_ENUM;
} }
if (comp) 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]; 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) u32 cellGcmSetUserHandler(u32 handler)
{ {
cellGcmSys.Warning("cellGcmSetUserHandler(handler=0x%x)", handler); cellGcmSys->Warning("cellGcmSetUserHandler(handler=0x%x)", handler);
return handler; return handler;
} }
@ -579,7 +579,7 @@ int cellGcmSetVBlankHandler()
int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt) int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
{ {
cellGcmSys.Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr()); cellGcmSys->Log("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
GSLockCurrent lock(GS_LOCK_WAIT_FLIP); GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
return CELL_OK; return CELL_OK;
@ -587,12 +587,12 @@ int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> 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) 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); index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
if (index >= RSXThread::m_zculls_count) 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; 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) int cellGcmUnbindTile(u8 index)
{ {
cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index); cellGcmSys->Warning("cellGcmUnbindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -632,11 +632,11 @@ int cellGcmUnbindTile(u8 index)
int cellGcmUnbindZcull(u8 index) int cellGcmUnbindZcull(u8 index)
{ {
cellGcmSys.Warning("cellGcmUnbindZcull(index=%d)", index); cellGcmSys->Warning("cellGcmUnbindZcull(index=%d)", index);
if (index >= 8) if (index >= 8)
{ {
cellGcmSys.Error("cellGcmUnbindZcull : CELL_EINVAL"); cellGcmSys->Error("cellGcmUnbindZcull : CELL_EINVAL");
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -648,29 +648,29 @@ int cellGcmUnbindZcull(u8 index)
u32 cellGcmGetTileInfo() u32 cellGcmGetTileInfo()
{ {
cellGcmSys.Warning("cellGcmGetTileInfo()"); cellGcmSys->Warning("cellGcmGetTileInfo()");
return Emu.GetGSManager().GetRender().m_tiles_addr; return Emu.GetGSManager().GetRender().m_tiles_addr;
} }
u32 cellGcmGetZcullInfo() u32 cellGcmGetZcullInfo()
{ {
cellGcmSys.Warning("cellGcmGetZcullInfo()"); cellGcmSys->Warning("cellGcmGetZcullInfo()");
return Emu.GetGSManager().GetRender().m_zculls_addr; return Emu.GetGSManager().GetRender().m_zculls_addr;
} }
u32 cellGcmGetDisplayInfo() 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; return Emu.GetGSManager().GetRender().m_gcm_buffers_addr;
} }
int cellGcmGetCurrentDisplayBufferId(u32 id_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)) if (!Memory.IsGoodAddr(id_addr))
{ {
cellGcmSys.Error("cellGcmGetCurrentDisplayBufferId : CELL_EFAULT"); cellGcmSys->Error("cellGcmGetCurrentDisplayBufferId : CELL_EFAULT");
return CELL_EFAULT; return CELL_EFAULT;
} }
@ -780,7 +780,7 @@ void InitOffsetTable()
int32_t cellGcmAddressToOffset(u64 address, mem32_t offset) 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*/) if (address >= 0xD0000000/*not on main memory or local*/)
return CELL_GCM_ERROR_FAILURE; 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) 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; 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 else
{ {
cellGcmSys.Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE"); cellGcmSys->Error("cellGcmMapEaIoAddress : CELL_GCM_ERROR_FAILURE");
return 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) 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 return cellGcmMapEaIoAddress(ea, io, size); // TODO: strict ordering
} }
@ -879,7 +879,7 @@ int32_t cellGcmMapLocalMemory(u64 address, u64 size)
} }
else else
{ {
cellGcmSys.Error("RSX local memory already mapped"); cellGcmSys->Error("RSX local memory already mapped");
return CELL_GCM_ERROR_FAILURE; 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) 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; u64 io;
@ -911,7 +911,7 @@ int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset)
} }
else 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; return CELL_GCM_ERROR_NO_IO_PAGE_TABLE;
} }
@ -924,13 +924,13 @@ int32_t cellGcmReserveIoMapSize(const u32 size)
{ {
if (size & 0xFFFFF) 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; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (size > cellGcmGetMaxIoMapSize()) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -955,7 +955,7 @@ int32_t cellGcmUnmapEaIoAddress(u64 ea)
} }
else else
{ {
cellGcmSys.Error("cellGcmUnmapEaIoAddress : CELL_GCM_ERROR_FAILURE"); cellGcmSys->Error("cellGcmUnmapEaIoAddress : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -979,7 +979,7 @@ int32_t cellGcmUnmapIoAddress(u64 io)
} }
else else
{ {
cellGcmSys.Error("cellGcmUnmapIoAddress : CELL_GCM_ERROR_FAILURE"); cellGcmSys->Error("cellGcmUnmapIoAddress : CELL_GCM_ERROR_FAILURE");
return CELL_GCM_ERROR_FAILURE; return CELL_GCM_ERROR_FAILURE;
} }
@ -991,13 +991,13 @@ int32_t cellGcmUnreserveIoMapSize(u32 size)
if (size & 0xFFFFF) 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; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if (size > Memory.RSXIOMem.GetReservedAmount()) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
@ -1051,7 +1051,7 @@ int cellGcmSetCursorImageOffset(u32 offset)
void cellGcmSetDefaultCommandBuffer() void cellGcmSetDefaultCommandBuffer()
{ {
cellGcmSys.Warning("cellGcmSetDefaultCommandBuffer()"); cellGcmSys->Warning("cellGcmSetDefaultCommandBuffer()");
Memory.Write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr); Memory.Write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr);
} }
@ -1066,7 +1066,7 @@ int cellGcmSetFlipCommand(u32 ctx, u32 id)
s64 cellGcmFunc15() s64 cellGcmFunc15()
{ {
cellGcmSys.Error("cellGcmFunc15()"); cellGcmSys->Error("cellGcmFunc15()");
return 0; 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) 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); index, location, offset, size, pitch, comp, base, bank);
// Copied form cellGcmSetTileInfo // Copied form cellGcmSetTileInfo
if(index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4) 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; return CELL_GCM_ERROR_INVALID_VALUE;
} }
if(offset & 0xffff || size & 0xffff || pitch & 0xf) 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; return CELL_GCM_ERROR_INVALID_ALIGNMENT;
} }
if(location >= 2 || (comp != 0 && (comp < 7 || comp > 12))) 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; return CELL_GCM_ERROR_INVALID_ENUM;
} }
if(comp) if(comp)
{ {
cellGcmSys.Error("cellGcmSetTile: bad comp! (%d)", comp); cellGcmSys->Error("cellGcmSetTile: bad comp! (%d)", comp);
} }
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index]; 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() void cellGcmSys_init()
{ {
// Data Retrieval // Data Retrieval
cellGcmSys.AddFunc(0xc8f3bd09, cellGcmGetCurrentField); cellGcmSys->AddFunc(0xc8f3bd09, cellGcmGetCurrentField);
cellGcmSys.AddFunc(0xf80196c1, cellGcmGetLabelAddress); cellGcmSys->AddFunc(0xf80196c1, cellGcmGetLabelAddress);
cellGcmSys.AddFunc(0x21cee035, cellGcmGetNotifyDataAddress); cellGcmSys->AddFunc(0x21cee035, cellGcmGetNotifyDataAddress);
cellGcmSys.AddFunc(0x99d397ac, cellGcmGetReport); cellGcmSys->AddFunc(0x99d397ac, cellGcmGetReport);
cellGcmSys.AddFunc(0x9a0159af, cellGcmGetReportDataAddress); cellGcmSys->AddFunc(0x9a0159af, cellGcmGetReportDataAddress);
cellGcmSys.AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation); cellGcmSys->AddFunc(0x8572bce2, cellGcmGetReportDataAddressLocation);
cellGcmSys.AddFunc(0xa6b180ac, cellGcmGetReportDataLocation); cellGcmSys->AddFunc(0xa6b180ac, cellGcmGetReportDataLocation);
cellGcmSys.AddFunc(0x5a41c10f, cellGcmGetTimeStamp); cellGcmSys->AddFunc(0x5a41c10f, cellGcmGetTimeStamp);
cellGcmSys.AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation); cellGcmSys->AddFunc(0x2ad4951b, cellGcmGetTimeStampLocation);
// Command Buffer Control // Command Buffer Control
cellGcmSys.AddFunc(0xa547adde, cellGcmGetControlRegister); cellGcmSys->AddFunc(0xa547adde, cellGcmGetControlRegister);
cellGcmSys.AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize); cellGcmSys->AddFunc(0x5e2ee0f0, cellGcmGetDefaultCommandWordSize);
cellGcmSys.AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize); cellGcmSys->AddFunc(0x8cdf8c70, cellGcmGetDefaultSegmentWordSize);
cellGcmSys.AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode); cellGcmSys->AddFunc(0xcaabd992, cellGcmInitDefaultFifoMode);
cellGcmSys.AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize); cellGcmSys->AddFunc(0x9ba451e4, cellGcmSetDefaultFifoSize);
//cellGcmSys.AddFunc(, cellGcmReserveMethodSize); //cellGcmSys->AddFunc(, cellGcmReserveMethodSize);
//cellGcmSys.AddFunc(, cellGcmResetDefaultCommandBuffer); //cellGcmSys->AddFunc(, cellGcmResetDefaultCommandBuffer);
//cellGcmSys.AddFunc(, cellGcmSetupContextData); //cellGcmSys->AddFunc(, cellGcmSetupContextData);
//cellGcmSys.AddFunc(, cellGcmCallbackForSnc); //cellGcmSys->AddFunc(, cellGcmCallbackForSnc);
//cellGcmSys.AddFunc(, cellGcmFinish); //cellGcmSys->AddFunc(, cellGcmFinish);
//cellGcmSys.AddFunc(, cellGcmFlush); //cellGcmSys->AddFunc(, cellGcmFlush);
// Hardware Resource Management // Hardware Resource Management
cellGcmSys.AddFunc(0x4524cccd, cellGcmBindTile); cellGcmSys->AddFunc(0x4524cccd, cellGcmBindTile);
cellGcmSys.AddFunc(0x9dc04436, cellGcmBindZcull); cellGcmSys->AddFunc(0x9dc04436, cellGcmBindZcull);
cellGcmSys.AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError); cellGcmSys->AddFunc(0x1f61b3ff, cellGcmDumpGraphicsError);
cellGcmSys.AddFunc(0xe315a0b2, cellGcmGetConfiguration); cellGcmSys->AddFunc(0xe315a0b2, cellGcmGetConfiguration);
cellGcmSys.AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex); cellGcmSys->AddFunc(0x371674cf, cellGcmGetDisplayBufferByFlipIndex);
cellGcmSys.AddFunc(0x72a577ce, cellGcmGetFlipStatus); cellGcmSys->AddFunc(0x72a577ce, cellGcmGetFlipStatus);
cellGcmSys.AddFunc(0x63387071, cellGcmgetLastFlipTime); cellGcmSys->AddFunc(0x63387071, cellGcmgetLastFlipTime);
cellGcmSys.AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime); cellGcmSys->AddFunc(0x23ae55a3, cellGcmGetLastSecondVTime);
cellGcmSys.AddFunc(0x055bd74d, cellGcmGetTiledPitchSize); cellGcmSys->AddFunc(0x055bd74d, cellGcmGetTiledPitchSize);
cellGcmSys.AddFunc(0x723bbc7e, cellGcmGetVBlankCount); cellGcmSys->AddFunc(0x723bbc7e, cellGcmGetVBlankCount);
cellGcmSys.AddFunc(0x15bae46b, cellGcmInit); cellGcmSys->AddFunc(0x15bae46b, cellGcmInit);
cellGcmSys.AddFunc(0xfce9e764, cellGcmInitSystemMode); cellGcmSys->AddFunc(0xfce9e764, cellGcmInitSystemMode);
cellGcmSys.AddFunc(0xb2e761d4, cellGcmResetFlipStatus); cellGcmSys->AddFunc(0xb2e761d4, cellGcmResetFlipStatus);
cellGcmSys.AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel); cellGcmSys->AddFunc(0x51c9d62b, cellGcmSetDebugOutputLevel);
cellGcmSys.AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer); cellGcmSys->AddFunc(0xa53d12ae, cellGcmSetDisplayBuffer);
cellGcmSys.AddFunc(0xdc09357e, cellGcmSetFlip); cellGcmSys->AddFunc(0xdc09357e, cellGcmSetFlip);
cellGcmSys.AddFunc(0xa41ef7e8, cellGcmSetFlipHandler); cellGcmSys->AddFunc(0xa41ef7e8, cellGcmSetFlipHandler);
cellGcmSys.AddFunc(0xacee8542, cellGcmSetFlipImmediate); cellGcmSys->AddFunc(0xacee8542, cellGcmSetFlipImmediate);
cellGcmSys.AddFunc(0x4ae8d215, cellGcmSetFlipMode); cellGcmSys->AddFunc(0x4ae8d215, cellGcmSetFlipMode);
cellGcmSys.AddFunc(0xa47c09ff, cellGcmSetFlipStatus); cellGcmSys->AddFunc(0xa47c09ff, cellGcmSetFlipStatus);
cellGcmSys.AddFunc(0xd01b570d, cellGcmSetGraphicsHandler); cellGcmSys->AddFunc(0xd01b570d, cellGcmSetGraphicsHandler);
cellGcmSys.AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip); cellGcmSys->AddFunc(0x0b4b62d5, cellGcmSetPrepareFlip);
cellGcmSys.AddFunc(0x0a862772, cellGcmSetQueueHandler); cellGcmSys->AddFunc(0x0a862772, cellGcmSetQueueHandler);
cellGcmSys.AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency); cellGcmSys->AddFunc(0x4d7ce993, cellGcmSetSecondVFrequency);
cellGcmSys.AddFunc(0xdc494430, cellGcmSetSecondVHandler); cellGcmSys->AddFunc(0xdc494430, cellGcmSetSecondVHandler);
cellGcmSys.AddFunc(0xbd100dbc, cellGcmSetTileInfo); cellGcmSys->AddFunc(0xbd100dbc, cellGcmSetTileInfo);
cellGcmSys.AddFunc(0x06edea9e, cellGcmSetUserHandler); cellGcmSys->AddFunc(0x06edea9e, cellGcmSetUserHandler);
cellGcmSys.AddFunc(0xffe0160e, cellGcmSetVBlankFrequency); cellGcmSys->AddFunc(0xffe0160e, cellGcmSetVBlankFrequency);
cellGcmSys.AddFunc(0xa91b0402, cellGcmSetVBlankHandler); cellGcmSys->AddFunc(0xa91b0402, cellGcmSetVBlankHandler);
cellGcmSys.AddFunc(0x983fb9aa, cellGcmSetWaitFlip); cellGcmSys->AddFunc(0x983fb9aa, cellGcmSetWaitFlip);
cellGcmSys.AddFunc(0xd34a420d, cellGcmSetZcull); cellGcmSys->AddFunc(0xd34a420d, cellGcmSetZcull);
cellGcmSys.AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress); cellGcmSys->AddFunc(0x25b40ab4, cellGcmSortRemapEaIoAddress);
cellGcmSys.AddFunc(0xd9b7653e, cellGcmUnbindTile); cellGcmSys->AddFunc(0xd9b7653e, cellGcmUnbindTile);
cellGcmSys.AddFunc(0xa75640e8, cellGcmUnbindZcull); cellGcmSys->AddFunc(0xa75640e8, cellGcmUnbindZcull);
cellGcmSys.AddFunc(0x657571f7, cellGcmGetTileInfo); cellGcmSys->AddFunc(0x657571f7, cellGcmGetTileInfo);
cellGcmSys.AddFunc(0xd9a0a879, cellGcmGetZcullInfo); cellGcmSys->AddFunc(0xd9a0a879, cellGcmGetZcullInfo);
cellGcmSys.AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo); cellGcmSys->AddFunc(0x0e6b0dae, cellGcmGetDisplayInfo);
cellGcmSys.AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId); cellGcmSys->AddFunc(0x93806525, cellGcmGetCurrentDisplayBufferId);
cellGcmSys.AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile); cellGcmSys->AddFunc(0xbd6d60d9, cellGcmSetInvalidateTile);
//cellGcmSys.AddFunc(, cellGcmSetFlipWithWaitLabel); //cellGcmSys->AddFunc(, cellGcmSetFlipWithWaitLabel);
// Memory Mapping // Memory Mapping
cellGcmSys.AddFunc(0x21ac3697, cellGcmAddressToOffset); cellGcmSys->AddFunc(0x21ac3697, cellGcmAddressToOffset);
cellGcmSys.AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize); cellGcmSys->AddFunc(0xfb81c03e, cellGcmGetMaxIoMapSize);
cellGcmSys.AddFunc(0x2922aed0, cellGcmGetOffsetTable); cellGcmSys->AddFunc(0x2922aed0, cellGcmGetOffsetTable);
cellGcmSys.AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress); cellGcmSys->AddFunc(0x2a6fba9c, cellGcmIoOffsetToAddress);
cellGcmSys.AddFunc(0x63441cb4, cellGcmMapEaIoAddress); cellGcmSys->AddFunc(0x63441cb4, cellGcmMapEaIoAddress);
cellGcmSys.AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags); cellGcmSys->AddFunc(0x626e8518, cellGcmMapEaIoAddressWithFlags);
cellGcmSys.AddFunc(0xdb769b32, cellGcmMapLocalMemory); cellGcmSys->AddFunc(0xdb769b32, cellGcmMapLocalMemory);
cellGcmSys.AddFunc(0xa114ec67, cellGcmMapMainMemory); cellGcmSys->AddFunc(0xa114ec67, cellGcmMapMainMemory);
cellGcmSys.AddFunc(0xa7ede268, cellGcmReserveIoMapSize); cellGcmSys->AddFunc(0xa7ede268, cellGcmReserveIoMapSize);
cellGcmSys.AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress); cellGcmSys->AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress);
cellGcmSys.AddFunc(0xdb23e867, cellGcmUnmapIoAddress); cellGcmSys->AddFunc(0xdb23e867, cellGcmUnmapIoAddress);
cellGcmSys.AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize); cellGcmSys->AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize);
// Cursor // Cursor
cellGcmSys.AddFunc(0x107bf3a1, cellGcmInitCursor); cellGcmSys->AddFunc(0x107bf3a1, cellGcmInitCursor);
cellGcmSys.AddFunc(0xc47d0812, cellGcmSetCursorEnable); cellGcmSys->AddFunc(0xc47d0812, cellGcmSetCursorEnable);
cellGcmSys.AddFunc(0x69c6cc82, cellGcmSetCursorDisable); cellGcmSys->AddFunc(0x69c6cc82, cellGcmSetCursorDisable);
cellGcmSys.AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset); cellGcmSys->AddFunc(0xf9bfdc72, cellGcmSetCursorImageOffset);
cellGcmSys.AddFunc(0x1a0de550, cellGcmSetCursorPosition); cellGcmSys->AddFunc(0x1a0de550, cellGcmSetCursorPosition);
cellGcmSys.AddFunc(0xbd2fa0a7, cellGcmUpdateCursor); cellGcmSys->AddFunc(0xbd2fa0a7, cellGcmUpdateCursor);
// Functions for Maintaining Compatibility // Functions for Maintaining Compatibility
cellGcmSys.AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer); cellGcmSys->AddFunc(0xbc982946, cellGcmSetDefaultCommandBuffer);
//cellGcmSys.AddFunc(, cellGcmGetCurrentBuffer); //cellGcmSys->AddFunc(, cellGcmGetCurrentBuffer);
//cellGcmSys.AddFunc(, cellGcmSetCurrentBuffer); //cellGcmSys->AddFunc(, cellGcmSetCurrentBuffer);
//cellGcmSys.AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize); //cellGcmSys->AddFunc(, cellGcmSetDefaultCommandBufferAndSegmentWordSize);
//cellGcmSys.AddFunc(, cellGcmSetUserCallback); //cellGcmSys->AddFunc(, cellGcmSetUserCallback);
// Other // Other
cellGcmSys.AddFunc(0x21397818, cellGcmSetFlipCommand); cellGcmSys->AddFunc(0x21397818, cellGcmSetFlipCommand);
cellGcmSys.AddFunc(0x3a33c1fd, cellGcmFunc15); cellGcmSys->AddFunc(0x3a33c1fd, cellGcmFunc15);
cellGcmSys.AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel); cellGcmSys->AddFunc(0xd8f88e1a, cellGcmSetFlipCommandWithWaitLabel);
cellGcmSys.AddFunc(0xd0b1d189, cellGcmSetTile); cellGcmSys->AddFunc(0xd0b1d189, cellGcmSetTile);
} }
void cellGcmSys_load() void cellGcmSys_load()

View file

@ -11,8 +11,9 @@
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
#include "stblib/stb_image.c" // (TODO: Should we put this elsewhere?) #include "stblib/stb_image.c" // (TODO: Should we put this elsewhere?)
void cellGifDec_init(); //void cellGifDec_init();
Module cellGifDec(0xf010, cellGifDec_init); //Module cellGifDec(0xf010, cellGifDec_init);
extern Module *cellGifDec = nullptr;
int cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) int cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
{ {
@ -73,7 +74,7 @@ int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDec
current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size
// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. // 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; return CELL_OK;
} }
@ -84,7 +85,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo
return CELL_GIFDEC_ERROR_ARG; return CELL_GIFDEC_ERROR_ARG;
CellGifDecSubHandle* subHandle_data; CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data)) if(!cellGifDec->CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; const u32& fd = subHandle_data->fd;
@ -125,7 +126,7 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellGi
return CELL_GIFDEC_ERROR_ARG; return CELL_GIFDEC_ERROR_ARG;
CellGifDecSubHandle* subHandle_data; CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data)) if(!cellGifDec->CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
CellGifDecInfo& current_info = subHandle_data->info; 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; dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
CellGifDecSubHandle* subHandle_data; CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data)) if(!cellGifDec->CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; 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) int cellGifDecClose(u32 mainHandle, u32 subHandle)
{ {
CellGifDecSubHandle* subHandle_data; CellGifDecSubHandle* subHandle_data;
if(!cellGifDec.CheckId(subHandle, subHandle_data)) if(!cellGifDec->CheckId(subHandle, subHandle_data))
return CELL_GIFDEC_ERROR_FATAL; return CELL_GIFDEC_ERROR_FATAL;
cellFsClose(subHandle_data->fd); cellFsClose(subHandle_data->fd);
@ -223,17 +224,17 @@ int cellGifDecDestroy(u32 mainHandle)
void cellGifDec_init() void cellGifDec_init()
{ {
cellGifDec.AddFunc(0xb60d42a5, cellGifDecCreate); cellGifDec->AddFunc(0xb60d42a5, cellGifDecCreate);
cellGifDec.AddFunc(0x4711cb7f, cellGifDecExtCreate); cellGifDec->AddFunc(0x4711cb7f, cellGifDecExtCreate);
cellGifDec.AddFunc(0x75745079, cellGifDecOpen); cellGifDec->AddFunc(0x75745079, cellGifDecOpen);
cellGifDec.AddFunc(0xf0da95de, cellGifDecReadHeader); cellGifDec->AddFunc(0xf0da95de, cellGifDecReadHeader);
cellGifDec.AddFunc(0x41a90dc4, cellGifDecSetParameter); cellGifDec->AddFunc(0x41a90dc4, cellGifDecSetParameter);
cellGifDec.AddFunc(0x44b1bc61, cellGifDecDecodeData); cellGifDec->AddFunc(0x44b1bc61, cellGifDecDecodeData);
cellGifDec.AddFunc(0x116a7da9, cellGifDecClose); cellGifDec->AddFunc(0x116a7da9, cellGifDecClose);
cellGifDec.AddFunc(0xe74b2cb1, cellGifDecDestroy); cellGifDec->AddFunc(0xe74b2cb1, cellGifDecDestroy);
/*cellGifDec.AddFunc(0x17fb83c1, cellGifDecExtOpen); /*cellGifDec->AddFunc(0x17fb83c1, cellGifDecExtOpen);
cellGifDec.AddFunc(0xe53f91f2, cellGifDecExtReadHeader); cellGifDec->AddFunc(0xe53f91f2, cellGifDecExtReadHeader);
cellGifDec.AddFunc(0x95cae771, cellGifDecExtSetParameter); cellGifDec->AddFunc(0x95cae771, cellGifDecExtSetParameter);
cellGifDec.AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/ cellGifDec->AddFunc(0x02e7e03e, cellGifDecExtDecodeData);*/
} }

View file

@ -8,8 +8,9 @@
#include "cellJpgDec.h" #include "cellJpgDec.h"
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
void cellJpgDec_init(); //void cellJpgDec_init();
Module cellJpgDec(0x000f, cellJpgDec_init); //Module cellJpgDec(0x000f, cellJpgDec_init);
extern Module *cellJpgDec = nullptr;
int cellJpgDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) 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<CellJpgDecSrc> src, mem_ptr_t<CellJpgDecOpnInfo> openInfo) int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> src, mem_ptr_t<CellJpgDecOpnInfo> 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); mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood()) if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood())
@ -52,7 +53,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> s
current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size
// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. // 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; return CELL_OK;
} }
@ -60,7 +61,7 @@ int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> s
int cellJpgDecClose(u32 mainHandle, u32 subHandle) int cellJpgDecClose(u32 mainHandle, u32 subHandle)
{ {
CellJpgDecSubHandle* subHandle_data; CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data)) if(!cellJpgDec->CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
cellFsClose(subHandle_data->fd); cellFsClose(subHandle_data->fd);
@ -71,13 +72,13 @@ int cellJpgDecClose(u32 mainHandle, u32 subHandle)
int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo> info) int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo> 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()) if (!info.IsGood())
return CELL_JPGDEC_ERROR_ARG; return CELL_JPGDEC_ERROR_ARG;
CellJpgDecSubHandle* subHandle_data; CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data)) if(!cellJpgDec->CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; 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; dataOutInfo->status = CELL_JPGDEC_DEC_STATUS_STOP;
CellJpgDecSubHandle* subHandle_data; CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data)) if(!cellJpgDec->CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; 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_UPSAMPLE_ONLY:
case CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA: case CELL_JPG_GRAYSCALE_TO_ALPHA_RGBA:
case CELL_JPG_GRAYSCALE_TO_ALPHA_ARGB: 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; break;
default: default:
@ -203,7 +204,7 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellJp
return CELL_JPGDEC_ERROR_ARG; return CELL_JPGDEC_ERROR_ARG;
CellJpgDecSubHandle* subHandle_data; CellJpgDecSubHandle* subHandle_data;
if(!cellJpgDec.CheckId(subHandle, subHandle_data)) if(!cellJpgDec->CheckId(subHandle, subHandle_data))
return CELL_JPGDEC_ERROR_FATAL; return CELL_JPGDEC_ERROR_FATAL;
CellJpgDecInfo& current_info = subHandle_data->info; CellJpgDecInfo& current_info = subHandle_data->info;
@ -243,17 +244,17 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellJp
void cellJpgDec_init() void cellJpgDec_init()
{ {
cellJpgDec.AddFunc(0xa7978f59, cellJpgDecCreate); cellJpgDec->AddFunc(0xa7978f59, cellJpgDecCreate);
cellJpgDec.AddFunc(0x8b300f66, cellJpgDecExtCreate); cellJpgDec->AddFunc(0x8b300f66, cellJpgDecExtCreate);
cellJpgDec.AddFunc(0x976ca5c2, cellJpgDecOpen); cellJpgDec->AddFunc(0x976ca5c2, cellJpgDecOpen);
cellJpgDec.AddFunc(0x6d9ebccf, cellJpgDecReadHeader); cellJpgDec->AddFunc(0x6d9ebccf, cellJpgDecReadHeader);
cellJpgDec.AddFunc(0xe08f3910, cellJpgDecSetParameter); cellJpgDec->AddFunc(0xe08f3910, cellJpgDecSetParameter);
cellJpgDec.AddFunc(0xaf8bb012, cellJpgDecDecodeData); cellJpgDec->AddFunc(0xaf8bb012, cellJpgDecDecodeData);
cellJpgDec.AddFunc(0x9338a07a, cellJpgDecClose); cellJpgDec->AddFunc(0x9338a07a, cellJpgDecClose);
cellJpgDec.AddFunc(0xd8ea91f8, cellJpgDecDestroy); cellJpgDec->AddFunc(0xd8ea91f8, cellJpgDecDestroy);
/*cellJpgDec.AddFunc(0xa9f703e3, cellJpgDecExtOpen); /*cellJpgDec->AddFunc(0xa9f703e3, cellJpgDecExtOpen);
cellJpgDec.AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader); cellJpgDec->AddFunc(0xb91eb3d2, cellJpgDecExtReadHeader);
cellJpgDec.AddFunc(0x65cbbb16, cellJpgDecExtSetParameter); cellJpgDec->AddFunc(0x65cbbb16, cellJpgDecExtSetParameter);
cellJpgDec.AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/ cellJpgDec->AddFunc(0x716f8792, cellJpgDecExtDecodeData);*/
} }

View file

@ -11,8 +11,10 @@
#include <codecvt> #include <codecvt>
#endif #endif
void cellL10n_init(); //void cellL10n_init();
Module cellL10n(0x001e, cellL10n_init); //Module cellL10n(0x001e, cellL10n_init);
Module *cellL10n = nullptr;
// L10nResult // L10nResult
enum enum
@ -38,7 +40,7 @@ enum
int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t utf8_len) 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()); utf16.GetAddr(), utf16_len.GetAddr(), utf8.GetAddr(), utf8_len.GetAddr());
if (!utf16.IsGood() || !utf16_len.IsGood() || !utf8_len.IsGood()) 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) int jstrchk(mem8_ptr_t jstr)
{ {
if (!jstr.IsGood()) 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]) 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 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; 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 // NOTE: I think this module should be LLE'd instead of implementing all its functions
// cellL10n.AddFunc(0x005200e6, UCS2toEUCJP); // cellL10n->AddFunc(0x005200e6, UCS2toEUCJP);
// cellL10n.AddFunc(0x01b0cbf4, l10n_convert); // cellL10n->AddFunc(0x01b0cbf4, l10n_convert);
// cellL10n.AddFunc(0x0356038c, UCS2toUTF32); // cellL10n->AddFunc(0x0356038c, UCS2toUTF32);
// cellL10n.AddFunc(0x05028763, jis2kuten); // cellL10n->AddFunc(0x05028763, jis2kuten);
// cellL10n.AddFunc(0x058addc8, UTF8toGB18030); // cellL10n->AddFunc(0x058addc8, UTF8toGB18030);
// cellL10n.AddFunc(0x060ee3b2, JISstoUTF8s); // cellL10n->AddFunc(0x060ee3b2, JISstoUTF8s);
// cellL10n.AddFunc(0x07168a83, SjisZen2Han); // cellL10n->AddFunc(0x07168a83, SjisZen2Han);
// cellL10n.AddFunc(0x0bc386c8, ToSjisLower); // cellL10n->AddFunc(0x0bc386c8, ToSjisLower);
// cellL10n.AddFunc(0x0bedf77d, UCS2toGB18030); // cellL10n->AddFunc(0x0bedf77d, UCS2toGB18030);
// cellL10n.AddFunc(0x0bf867e2, HZstoUCS2s); // cellL10n->AddFunc(0x0bf867e2, HZstoUCS2s);
// cellL10n.AddFunc(0x0ce278fd, UCS2stoHZs); // cellL10n->AddFunc(0x0ce278fd, UCS2stoHZs);
// cellL10n.AddFunc(0x0d90a48d, UCS2stoSJISs); // cellL10n->AddFunc(0x0d90a48d, UCS2stoSJISs);
// cellL10n.AddFunc(0x0f624540, kuten2eucjp); // cellL10n->AddFunc(0x0f624540, kuten2eucjp);
// cellL10n.AddFunc(0x14ee3649, sjis2jis); // cellL10n->AddFunc(0x14ee3649, sjis2jis);
// cellL10n.AddFunc(0x14f504b8, EUCKRstoUCS2s); // cellL10n->AddFunc(0x14f504b8, EUCKRstoUCS2s);
// cellL10n.AddFunc(0x16eaf5f1, UHCstoEUCKRs); // cellL10n->AddFunc(0x16eaf5f1, UHCstoEUCKRs);
// cellL10n.AddFunc(0x1758053c, jis2sjis); // cellL10n->AddFunc(0x1758053c, jis2sjis);
// cellL10n.AddFunc(0x1906ce6b, jstrnchk); // cellL10n->AddFunc(0x1906ce6b, jstrnchk);
// cellL10n.AddFunc(0x1ac0d23d, L10nConvert); // cellL10n->AddFunc(0x1ac0d23d, L10nConvert);
// cellL10n.AddFunc(0x1ae2acee, EUCCNstoUTF8s); // cellL10n->AddFunc(0x1ae2acee, EUCCNstoUTF8s);
// cellL10n.AddFunc(0x1cb1138f, GBKstoUCS2s); // cellL10n->AddFunc(0x1cb1138f, GBKstoUCS2s);
// cellL10n.AddFunc(0x1da42d70, eucjphan2zen); // cellL10n->AddFunc(0x1da42d70, eucjphan2zen);
// cellL10n.AddFunc(0x1ec712e0, ToSjisHira); // cellL10n->AddFunc(0x1ec712e0, ToSjisHira);
// cellL10n.AddFunc(0x1fb50183, GBKtoUCS2); // cellL10n->AddFunc(0x1fb50183, GBKtoUCS2);
// cellL10n.AddFunc(0x21948c03, eucjp2jis); // cellL10n->AddFunc(0x21948c03, eucjp2jis);
// cellL10n.AddFunc(0x21aa3045, UTF32stoUTF8s); // cellL10n->AddFunc(0x21aa3045, UTF32stoUTF8s);
// cellL10n.AddFunc(0x24fd32a9, sjishan2zen); // cellL10n->AddFunc(0x24fd32a9, sjishan2zen);
// cellL10n.AddFunc(0x256b6861, UCS2toSBCS); // cellL10n->AddFunc(0x256b6861, UCS2toSBCS);
// cellL10n.AddFunc(0x262a5ae2, UTF8stoGBKs); // cellL10n->AddFunc(0x262a5ae2, UTF8stoGBKs);
// cellL10n.AddFunc(0x28724522, UTF8toUCS2); // cellL10n->AddFunc(0x28724522, UTF8toUCS2);
// cellL10n.AddFunc(0x2ad091c6, UCS2stoUTF8s); // cellL10n->AddFunc(0x2ad091c6, UCS2stoUTF8s);
// cellL10n.AddFunc(0x2b84030c, EUCKRstoUTF8s); // cellL10n->AddFunc(0x2b84030c, EUCKRstoUTF8s);
// cellL10n.AddFunc(0x2efa7294, UTF16stoUTF32s); // cellL10n->AddFunc(0x2efa7294, UTF16stoUTF32s);
// cellL10n.AddFunc(0x2f9eb543, UTF8toEUCKR); // cellL10n->AddFunc(0x2f9eb543, UTF8toEUCKR);
// cellL10n.AddFunc(0x317ab7c2, UTF16toUTF8); // cellL10n->AddFunc(0x317ab7c2, UTF16toUTF8);
// cellL10n.AddFunc(0x32689828, ARIBstoUTF8s); // cellL10n->AddFunc(0x32689828, ARIBstoUTF8s);
// cellL10n.AddFunc(0x33435818, SJISstoUTF8s); // cellL10n->AddFunc(0x33435818, SJISstoUTF8s);
// cellL10n.AddFunc(0x33f8b35c, sjiszen2han); // cellL10n->AddFunc(0x33f8b35c, sjiszen2han);
// cellL10n.AddFunc(0x3968f176, ToEucJpLower); // cellL10n->AddFunc(0x3968f176, ToEucJpLower);
// cellL10n.AddFunc(0x398a3dee, MSJIStoUTF8); // cellL10n->AddFunc(0x398a3dee, MSJIStoUTF8);
// cellL10n.AddFunc(0x3a20bc34, UCS2stoMSJISs); // cellL10n->AddFunc(0x3a20bc34, UCS2stoMSJISs);
// cellL10n.AddFunc(0x3dabd5a7, EUCJPtoUTF8); // cellL10n->AddFunc(0x3dabd5a7, EUCJPtoUTF8);
// cellL10n.AddFunc(0x3df65b64, eucjp2sjis); // cellL10n->AddFunc(0x3df65b64, eucjp2sjis);
// cellL10n.AddFunc(0x408a622b, ToEucJpHira); // cellL10n->AddFunc(0x408a622b, ToEucJpHira);
// cellL10n.AddFunc(0x41b4a5ae, UHCstoUCS2s); // cellL10n->AddFunc(0x41b4a5ae, UHCstoUCS2s);
// cellL10n.AddFunc(0x41ccf033, ToEucJpKata); // cellL10n->AddFunc(0x41ccf033, ToEucJpKata);
// cellL10n.AddFunc(0x42838145, HZstoUTF8s); // cellL10n->AddFunc(0x42838145, HZstoUTF8s);
// cellL10n.AddFunc(0x4931b44e, UTF8toMSJIS); // cellL10n->AddFunc(0x4931b44e, UTF8toMSJIS);
// cellL10n.AddFunc(0x4b3bbacb, BIG5toUTF8); // cellL10n->AddFunc(0x4b3bbacb, BIG5toUTF8);
// cellL10n.AddFunc(0x511d386b, EUCJPstoSJISs); // cellL10n->AddFunc(0x511d386b, EUCJPstoSJISs);
// cellL10n.AddFunc(0x52b7883f, UTF8stoBIG5s); // cellL10n->AddFunc(0x52b7883f, UTF8stoBIG5s);
// cellL10n.AddFunc(0x53558b6b, UTF16stoUCS2s); // cellL10n->AddFunc(0x53558b6b, UTF16stoUCS2s);
// cellL10n.AddFunc(0x53764725, UCS2stoGB18030s); // cellL10n->AddFunc(0x53764725, UCS2stoGB18030s);
// cellL10n.AddFunc(0x53c71ac2, EUCJPtoSJIS); // cellL10n->AddFunc(0x53c71ac2, EUCJPtoSJIS);
// cellL10n.AddFunc(0x54f59807, EUCJPtoUCS2); // cellL10n->AddFunc(0x54f59807, EUCJPtoUCS2);
// cellL10n.AddFunc(0x55f6921c, UCS2stoGBKs); // cellL10n->AddFunc(0x55f6921c, UCS2stoGBKs);
// cellL10n.AddFunc(0x58246762, EUCKRtoUHC); // cellL10n->AddFunc(0x58246762, EUCKRtoUHC);
// cellL10n.AddFunc(0x596df41c, UCS2toSJIS); // cellL10n->AddFunc(0x596df41c, UCS2toSJIS);
// cellL10n.AddFunc(0x5a4ab223, MSJISstoUTF8s); // cellL10n->AddFunc(0x5a4ab223, MSJISstoUTF8s);
// cellL10n.AddFunc(0x5ac783dc, EUCJPstoUTF8s); // cellL10n->AddFunc(0x5ac783dc, EUCJPstoUTF8s);
// cellL10n.AddFunc(0x5b684dfb, UCS2toBIG5); // cellL10n->AddFunc(0x5b684dfb, UCS2toBIG5);
// cellL10n.AddFunc(0x5cd29270, UTF8stoEUCKRs); // cellL10n->AddFunc(0x5cd29270, UTF8stoEUCKRs);
// cellL10n.AddFunc(0x5e1d9330, UHCstoUTF8s); // cellL10n->AddFunc(0x5e1d9330, UHCstoUTF8s);
// cellL10n.AddFunc(0x60ffa0ec, GB18030stoUCS2s); // cellL10n->AddFunc(0x60ffa0ec, GB18030stoUCS2s);
// cellL10n.AddFunc(0x6122e000, SJIStoUTF8); // cellL10n->AddFunc(0x6122e000, SJIStoUTF8);
// cellL10n.AddFunc(0x6169f205, JISstoSJISs); // cellL10n->AddFunc(0x6169f205, JISstoSJISs);
// cellL10n.AddFunc(0x61fb9442, UTF8toUTF16); // cellL10n->AddFunc(0x61fb9442, UTF8toUTF16);
// cellL10n.AddFunc(0x62b36bcf, UTF8stoMSJISs); // cellL10n->AddFunc(0x62b36bcf, UTF8stoMSJISs);
// cellL10n.AddFunc(0x63219199, EUCKRtoUTF8); // cellL10n->AddFunc(0x63219199, EUCKRtoUTF8);
// cellL10n.AddFunc(0x638c2fc1, SjisHan2Zen); // cellL10n->AddFunc(0x638c2fc1, SjisHan2Zen);
// cellL10n.AddFunc(0x64a10ec8, UCS2toUTF16); // cellL10n->AddFunc(0x64a10ec8, UCS2toUTF16);
// cellL10n.AddFunc(0x65444204, UCS2toMSJIS); // cellL10n->AddFunc(0x65444204, UCS2toMSJIS);
// cellL10n.AddFunc(0x6621a82c, sjis2kuten); // cellL10n->AddFunc(0x6621a82c, sjis2kuten);
// cellL10n.AddFunc(0x6a6f25d1, UCS2toUHC); // cellL10n->AddFunc(0x6a6f25d1, UCS2toUHC);
// cellL10n.AddFunc(0x6c62d879, UTF32toUCS2); // cellL10n->AddFunc(0x6c62d879, UTF32toUCS2);
// cellL10n.AddFunc(0x6de4b508, ToSjisUpper); // cellL10n->AddFunc(0x6de4b508, ToSjisUpper);
// cellL10n.AddFunc(0x6e0705c4, UTF8toEUCJP); // cellL10n->AddFunc(0x6e0705c4, UTF8toEUCJP);
// cellL10n.AddFunc(0x6e5906fd, UCS2stoEUCJPs); // cellL10n->AddFunc(0x6e5906fd, UCS2stoEUCJPs);
// cellL10n.AddFunc(0x6fc530b3, UTF16toUCS2); // cellL10n->AddFunc(0x6fc530b3, UTF16toUCS2);
// cellL10n.AddFunc(0x714a9b4a, UCS2stoUTF16s); // cellL10n->AddFunc(0x714a9b4a, UCS2stoUTF16s);
// cellL10n.AddFunc(0x71804d64, UCS2stoEUCCNs); // cellL10n->AddFunc(0x71804d64, UCS2stoEUCCNs);
// cellL10n.AddFunc(0x72632e53, SBCSstoUTF8s); // cellL10n->AddFunc(0x72632e53, SBCSstoUTF8s);
// cellL10n.AddFunc(0x73f2cd21, SJISstoJISs); // cellL10n->AddFunc(0x73f2cd21, SJISstoJISs);
// cellL10n.AddFunc(0x74496718, SBCStoUTF8); // cellL10n->AddFunc(0x74496718, SBCStoUTF8);
// cellL10n.AddFunc(0x74871fe0, UTF8toUTF32); // cellL10n->AddFunc(0x74871fe0, UTF8toUTF32);
cellL10n.AddFunc(0x750c363d, jstrchk); cellL10n->AddFunc(0x750c363d, jstrchk);
// cellL10n.AddFunc(0x7c5bde1c, UHCtoEUCKR); // cellL10n->AddFunc(0x7c5bde1c, UHCtoEUCKR);
// cellL10n.AddFunc(0x7c912bda, kuten2jis); // cellL10n->AddFunc(0x7c912bda, kuten2jis);
// cellL10n.AddFunc(0x7d07a1c2, UTF8toEUCCN); // cellL10n->AddFunc(0x7d07a1c2, UTF8toEUCCN);
// cellL10n.AddFunc(0x8171c1cc, EUCCNtoUTF8); // cellL10n->AddFunc(0x8171c1cc, EUCCNtoUTF8);
// cellL10n.AddFunc(0x82d5ecdf, EucJpZen2Han); // cellL10n->AddFunc(0x82d5ecdf, EucJpZen2Han);
// cellL10n.AddFunc(0x8555fe15, UTF32stoUTF16s); // cellL10n->AddFunc(0x8555fe15, UTF32stoUTF16s);
// cellL10n.AddFunc(0x860fc741, GBKtoUTF8); // cellL10n->AddFunc(0x860fc741, GBKtoUTF8);
// cellL10n.AddFunc(0x867f7b8b, ToEucJpUpper); // cellL10n->AddFunc(0x867f7b8b, ToEucJpUpper);
// cellL10n.AddFunc(0x88f8340b, UCS2stoJISs); // cellL10n->AddFunc(0x88f8340b, UCS2stoJISs);
// cellL10n.AddFunc(0x89236c86, UTF8stoGB18030s); // cellL10n->AddFunc(0x89236c86, UTF8stoGB18030s);
// cellL10n.AddFunc(0x8a56f148, EUCKRstoUHCs); // cellL10n->AddFunc(0x8a56f148, EUCKRstoUHCs);
// cellL10n.AddFunc(0x8ccdba38, UTF8stoUTF32s); // cellL10n->AddFunc(0x8ccdba38, UTF8stoUTF32s);
// cellL10n.AddFunc(0x8f472054, UTF8stoEUCCNs); // cellL10n->AddFunc(0x8f472054, UTF8stoEUCCNs);
// cellL10n.AddFunc(0x90e9b5d2, EUCJPstoUCS2s); // cellL10n->AddFunc(0x90e9b5d2, EUCJPstoUCS2s);
// cellL10n.AddFunc(0x91a99765, UHCtoUCS2); // cellL10n->AddFunc(0x91a99765, UHCtoUCS2);
// cellL10n.AddFunc(0x931ff25a, L10nConvertStr); // cellL10n->AddFunc(0x931ff25a, L10nConvertStr);
// cellL10n.AddFunc(0x949bb14c, GBKstoUTF8s); // cellL10n->AddFunc(0x949bb14c, GBKstoUTF8s);
// cellL10n.AddFunc(0x9557ac9b, UTF8toUHC); // cellL10n->AddFunc(0x9557ac9b, UTF8toUHC);
// cellL10n.AddFunc(0x9768b6d3, UTF32toUTF8); // cellL10n->AddFunc(0x9768b6d3, UTF32toUTF8);
// cellL10n.AddFunc(0x9874020d, sjis2eucjp); // cellL10n->AddFunc(0x9874020d, sjis2eucjp);
// cellL10n.AddFunc(0x9a0e7d23, UCS2toEUCCN); // cellL10n->AddFunc(0x9a0e7d23, UCS2toEUCCN);
// cellL10n.AddFunc(0x9a13d6b8, UTF8stoUHCs); // cellL10n->AddFunc(0x9a13d6b8, UTF8stoUHCs);
// cellL10n.AddFunc(0x9a72059d, EUCKRtoUCS2); // cellL10n->AddFunc(0x9a72059d, EUCKRtoUCS2);
// cellL10n.AddFunc(0x9b1210c6, UTF32toUTF16); // cellL10n->AddFunc(0x9b1210c6, UTF32toUTF16);
// cellL10n.AddFunc(0x9cd8135b, EUCCNstoUCS2s); // cellL10n->AddFunc(0x9cd8135b, EUCCNstoUCS2s);
// cellL10n.AddFunc(0x9ce52809, SBCSstoUCS2s); // cellL10n->AddFunc(0x9ce52809, SBCSstoUCS2s);
// cellL10n.AddFunc(0x9cf1ab77, UTF8stoJISs); // cellL10n->AddFunc(0x9cf1ab77, UTF8stoJISs);
// cellL10n.AddFunc(0x9d14dc46, ToSjisKata); // cellL10n->AddFunc(0x9d14dc46, ToSjisKata);
// cellL10n.AddFunc(0x9dcde367, jis2eucjp); // cellL10n->AddFunc(0x9dcde367, jis2eucjp);
// cellL10n.AddFunc(0x9ec52258, BIG5toUCS2); // cellL10n->AddFunc(0x9ec52258, BIG5toUCS2);
// cellL10n.AddFunc(0xa0d463c0, UCS2toGBK); // cellL10n->AddFunc(0xa0d463c0, UCS2toGBK);
// cellL10n.AddFunc(0xa19fb9de, UTF16toUTF32); // cellL10n->AddFunc(0xa19fb9de, UTF16toUTF32);
// cellL10n.AddFunc(0xa298cad2, l10n_convert_str); // cellL10n->AddFunc(0xa298cad2, l10n_convert_str);
// cellL10n.AddFunc(0xa34fa0eb, EUCJPstoJISs); // cellL10n->AddFunc(0xa34fa0eb, EUCJPstoJISs);
// cellL10n.AddFunc(0xa5146299, UTF8stoARIBs); // cellL10n->AddFunc(0xa5146299, UTF8stoARIBs);
// cellL10n.AddFunc(0xa609f3e9, JISstoEUCJPs); // cellL10n->AddFunc(0xa609f3e9, JISstoEUCJPs);
// cellL10n.AddFunc(0xa60ff5c9, EucJpHan2Zen); // cellL10n->AddFunc(0xa60ff5c9, EucJpHan2Zen);
// cellL10n.AddFunc(0xa963619c, isEucJpKigou); // cellL10n->AddFunc(0xa963619c, isEucJpKigou);
// cellL10n.AddFunc(0xa9a76fb8, UCS2toUTF8); // cellL10n->AddFunc(0xa9a76fb8, UCS2toUTF8);
// cellL10n.AddFunc(0xaf18d499, GB18030toUCS2); // cellL10n->AddFunc(0xaf18d499, GB18030toUCS2);
// cellL10n.AddFunc(0xb3361be6, UHCtoUTF8); // cellL10n->AddFunc(0xb3361be6, UHCtoUTF8);
// cellL10n.AddFunc(0xb6e45343, MSJIStoUCS2); // cellL10n->AddFunc(0xb6e45343, MSJIStoUCS2);
// cellL10n.AddFunc(0xb7cef4a6, UTF8toGBK); // cellL10n->AddFunc(0xb7cef4a6, UTF8toGBK);
// cellL10n.AddFunc(0xb7e08f7a, kuten2sjis); // cellL10n->AddFunc(0xb7e08f7a, kuten2sjis);
// cellL10n.AddFunc(0xb9cf473d, UTF8toSBCS); // cellL10n->AddFunc(0xb9cf473d, UTF8toSBCS);
// cellL10n.AddFunc(0xbdd44ee3, SJIStoUCS2); // cellL10n->AddFunc(0xbdd44ee3, SJIStoUCS2);
// cellL10n.AddFunc(0xbe42e661, eucjpzen2han); // cellL10n->AddFunc(0xbe42e661, eucjpzen2han);
// cellL10n.AddFunc(0xbe8d5485, UCS2stoARIBs); // cellL10n->AddFunc(0xbe8d5485, UCS2stoARIBs);
// cellL10n.AddFunc(0xbefe3869, isSjisKigou); // cellL10n->AddFunc(0xbefe3869, isSjisKigou);
// cellL10n.AddFunc(0xc62b758d, UTF8stoEUCJPs); // cellL10n->AddFunc(0xc62b758d, UTF8stoEUCJPs);
// cellL10n.AddFunc(0xc7bdcb4c, UCS2toEUCKR); // cellL10n->AddFunc(0xc7bdcb4c, UCS2toEUCKR);
// cellL10n.AddFunc(0xc944fa56, SBCStoUCS2); // cellL10n->AddFunc(0xc944fa56, SBCStoUCS2);
// cellL10n.AddFunc(0xc9b78f58, MSJISstoUCS2s); // cellL10n->AddFunc(0xc9b78f58, MSJISstoUCS2s);
// cellL10n.AddFunc(0xcc1633cc, l10n_get_converter); // cellL10n->AddFunc(0xcc1633cc, l10n_get_converter);
// cellL10n.AddFunc(0xd02ef83d, GB18030stoUTF8s); // cellL10n->AddFunc(0xd02ef83d, GB18030stoUTF8s);
// cellL10n.AddFunc(0xd8721e2c, SJISstoEUCJPs); // cellL10n->AddFunc(0xd8721e2c, SJISstoEUCJPs);
// cellL10n.AddFunc(0xd8cb24cb, UTF32stoUCS2s); // cellL10n->AddFunc(0xd8cb24cb, UTF32stoUCS2s);
// cellL10n.AddFunc(0xd990858b, BIG5stoUTF8s); // cellL10n->AddFunc(0xd990858b, BIG5stoUTF8s);
// cellL10n.AddFunc(0xd9fb1224, EUCCNtoUCS2); // cellL10n->AddFunc(0xd9fb1224, EUCCNtoUCS2);
// cellL10n.AddFunc(0xda67b37f, UTF8stoSBCSs); // cellL10n->AddFunc(0xda67b37f, UTF8stoSBCSs);
// cellL10n.AddFunc(0xdc54886c, UCS2stoEUCKRs); // cellL10n->AddFunc(0xdc54886c, UCS2stoEUCKRs);
// cellL10n.AddFunc(0xdd5ebdeb, UTF8stoSJISs); // cellL10n->AddFunc(0xdd5ebdeb, UTF8stoSJISs);
// cellL10n.AddFunc(0xdefa1c17, UTF8stoHZs); // cellL10n->AddFunc(0xdefa1c17, UTF8stoHZs);
// cellL10n.AddFunc(0xe2eabb32, eucjp2kuten); // cellL10n->AddFunc(0xe2eabb32, eucjp2kuten);
// cellL10n.AddFunc(0xe6d9e234, UTF8toBIG5); // cellL10n->AddFunc(0xe6d9e234, UTF8toBIG5);
cellL10n.AddFunc(0xe6f5711b, UTF16stoUTF8s); cellL10n->AddFunc(0xe6f5711b, UTF16stoUTF8s);
// cellL10n.AddFunc(0xe956dc64, JISstoUCS2s); // cellL10n->AddFunc(0xe956dc64, JISstoUCS2s);
// cellL10n.AddFunc(0xeabc3d00, GB18030toUTF8); // cellL10n->AddFunc(0xeabc3d00, GB18030toUTF8);
// cellL10n.AddFunc(0xeb3dc670, UTF8toSJIS); // cellL10n->AddFunc(0xeb3dc670, UTF8toSJIS);
// cellL10n.AddFunc(0xeb41cc68, ARIBstoUCS2s); // cellL10n->AddFunc(0xeb41cc68, ARIBstoUCS2s);
// cellL10n.AddFunc(0xeb685b83, UCS2stoUTF32s); // cellL10n->AddFunc(0xeb685b83, UCS2stoUTF32s);
// cellL10n.AddFunc(0xebae29c0, UCS2stoSBCSs); // cellL10n->AddFunc(0xebae29c0, UCS2stoSBCSs);
// cellL10n.AddFunc(0xee6c6a39, UCS2stoBIG5s); // cellL10n->AddFunc(0xee6c6a39, UCS2stoBIG5s);
// cellL10n.AddFunc(0xf1dcfa71, UCS2stoUHCs); // cellL10n->AddFunc(0xf1dcfa71, UCS2stoUHCs);
// cellL10n.AddFunc(0xf439728e, SJIStoEUCJP); // cellL10n->AddFunc(0xf439728e, SJIStoEUCJP);
// cellL10n.AddFunc(0xf7681b9a, UTF8stoUTF16s); // cellL10n->AddFunc(0xf7681b9a, UTF8stoUTF16s);
// cellL10n.AddFunc(0xf9b1896d, SJISstoUCS2s); // cellL10n->AddFunc(0xf9b1896d, SJISstoUCS2s);
// cellL10n.AddFunc(0xfa4a675a, BIG5stoUCS2s); // cellL10n->AddFunc(0xfa4a675a, BIG5stoUCS2s);
// cellL10n.AddFunc(0xfdbf6ac5, UTF8stoUCS2s); // cellL10n->AddFunc(0xfdbf6ac5, UTF8stoUCS2s);
} }

View file

@ -6,8 +6,9 @@
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
void cellNetCtl_init(); //void cellNetCtl_init();
Module cellNetCtl(0x0014, cellNetCtl_init); //Module cellNetCtl(0x0014, cellNetCtl_init);
Module *cellNetCtl;
// Error Codes // Error Codes
enum enum
@ -72,7 +73,7 @@ int cellNetCtlTerm()
int cellNetCtlGetState(mem32_t state) 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()) if (!state.IsGood())
return CELL_NET_CTL_ERROR_INVALID_ADDR; return CELL_NET_CTL_ERROR_INVALID_ADDR;
@ -125,18 +126,18 @@ int cellNetCtlGetNatInfo()
void cellNetCtl_init() void cellNetCtl_init()
{ {
cellNetCtl.AddFunc(0xbd5a59fc, cellNetCtlInit); cellNetCtl->AddFunc(0xbd5a59fc, cellNetCtlInit);
cellNetCtl.AddFunc(0x105ee2cb, cellNetCtlTerm); cellNetCtl->AddFunc(0x105ee2cb, cellNetCtlTerm);
cellNetCtl.AddFunc(0x8b3eba69, cellNetCtlGetState); cellNetCtl->AddFunc(0x8b3eba69, cellNetCtlGetState);
cellNetCtl.AddFunc(0x0ce13c6b, cellNetCtlAddHandler); cellNetCtl->AddFunc(0x0ce13c6b, cellNetCtlAddHandler);
cellNetCtl.AddFunc(0x901815c3, cellNetCtlDelHandler); cellNetCtl->AddFunc(0x901815c3, cellNetCtlDelHandler);
cellNetCtl.AddFunc(0x1e585b5d, cellNetCtlGetInfo); cellNetCtl->AddFunc(0x1e585b5d, cellNetCtlGetInfo);
cellNetCtl.AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync); cellNetCtl->AddFunc(0x04459230, cellNetCtlNetStartDialogLoadAsync);
cellNetCtl.AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync); cellNetCtl->AddFunc(0x71d53210, cellNetCtlNetStartDialogAbortAsync);
cellNetCtl.AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync); cellNetCtl->AddFunc(0x0f1f13d3, cellNetCtlNetStartDialogUnloadAsync);
cellNetCtl.AddFunc(0x3a12865f, cellNetCtlGetNatInfo); cellNetCtl->AddFunc(0x3a12865f, cellNetCtlGetNatInfo);
} }

View file

@ -7,8 +7,10 @@
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "cellPamf.h" #include "cellPamf.h"
void cellPamf_init(); //void cellPamf_init();
Module cellPamf(0x0012, cellPamf_init); //Module cellPamf(0x0012, cellPamf_init);
Module *cellPamf = nullptr;
int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pEsFilterId) int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pEsFilterId)
{ {
@ -30,7 +32,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0; pEsFilterId->supplementalInfo2 = 0;
} }
else 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; break;
case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS: case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS:
@ -42,7 +44,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0; pEsFilterId->supplementalInfo2 = 0;
} }
else 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; break;
case CELL_PAMF_STREAM_TYPE_PAMF_LPCM: case CELL_PAMF_STREAM_TYPE_PAMF_LPCM:
if (ch == 0) if (ch == 0)
@ -53,7 +55,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0; pEsFilterId->supplementalInfo2 = 0;
} }
else 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; break;
case CELL_PAMF_STREAM_TYPE_USER_DATA: case CELL_PAMF_STREAM_TYPE_USER_DATA:
if (ch == 0) if (ch == 0)
@ -64,13 +66,13 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pE
pEsFilterId->supplementalInfo2 = 0; pEsFilterId->supplementalInfo2 = 0;
} }
else 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; break;
case CELL_PAMF_STREAM_TYPE_AC3: 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; break;
case CELL_PAMF_STREAM_TYPE_M2V: 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; break;
default: default:
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
@ -90,7 +92,7 @@ u8 pamfGetStreamType(mem_ptr_t<CellPamfReader> pSelf, u8 stream)
case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM; case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM;
case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA; case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA;
default: 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); pAddr->stream_headers[stream].type);
return 0; return 0;
} }
@ -107,13 +109,13 @@ u8 pamfGetStreamChannel(mem_ptr_t<CellPamfReader> pSelf, u8 stream)
{ {
return pAddr->stream_headers[stream].stream_id - 0xe0; return pAddr->stream_headers[stream].stream_id - 0xe0;
} }
cellPamf.Error("TODO: pamfGetStreamChannel (-> 0)"); cellPamf->Error("TODO: pamfGetStreamChannel (-> 0)");
return 0; return 0;
} }
int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pSize) int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> 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()); pAddr.GetAddr(), fileSize, pSize.GetAddr());
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood())
@ -129,7 +131,7 @@ int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pSi
int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute, mem64_t pSize) int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> 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()); pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr());
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood()) if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pSize.IsGood())
@ -145,7 +147,7 @@ int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attrib
int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pOffset, mem64_t pSize) int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> 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()); pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr());
if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pOffset.IsGood() || !pSize.IsGood()) if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048) || !pOffset.IsGood() || !pSize.IsGood())
@ -163,7 +165,7 @@ int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, me
int cellPamfVerify(mem_ptr_t<PamfHeader> pAddr, u64 fileSize) int cellPamfVerify(mem_ptr_t<PamfHeader> 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)) if (!Memory.IsGoodAddr(pAddr.GetAddr(), 2048))
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
@ -177,7 +179,7 @@ int cellPamfReaderInitialize(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<PamfHead
if (Ini.SkipPamf.GetValue()) if (Ini.SkipPamf.GetValue())
return -1; return -1;
cellPamf.Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)",
pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute); pSelf.GetAddr(), pAddr.GetAddr(), fileSize, attribute);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pAddr.GetAddr(), 2048)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pAddr.GetAddr(), 2048))
@ -204,7 +206,7 @@ int cellPamfReaderInitialize(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<PamfHead
int cellPamfReaderGetPresentationStartTime(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp) int cellPamfReaderGetPresentationStartTime(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> 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()); pSelf.GetAddr(), pTimeStamp.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -219,7 +221,7 @@ int cellPamfReaderGetPresentationStartTime(mem_ptr_t<CellPamfReader> pSelf, mem_
int cellPamfReaderGetPresentationEndTime(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp) int cellPamfReaderGetPresentationEndTime(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> 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()); pSelf.GetAddr(), pTimeStamp.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -234,7 +236,7 @@ int cellPamfReaderGetPresentationEndTime(mem_ptr_t<CellPamfReader> pSelf, mem_pt
int cellPamfReaderGetMuxRateBound(mem_ptr_t<CellPamfReader> pSelf) int cellPamfReaderGetMuxRateBound(mem_ptr_t<CellPamfReader> pSelf)
{ {
cellPamf.Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr()); cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
@ -245,7 +247,7 @@ int cellPamfReaderGetMuxRateBound(mem_ptr_t<CellPamfReader> pSelf)
int cellPamfReaderGetNumberOfStreams(mem_ptr_t<CellPamfReader> pSelf) int cellPamfReaderGetNumberOfStreams(mem_ptr_t<CellPamfReader> pSelf)
{ {
cellPamf.Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr()); cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
@ -256,7 +258,7 @@ int cellPamfReaderGetNumberOfStreams(mem_ptr_t<CellPamfReader> pSelf)
int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t<CellPamfReader> pSelf, u8 streamType) int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t<CellPamfReader> pSelf, u8 streamType)
{ {
cellPamf.Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)",
pSelf.GetAddr(), streamType); pSelf.GetAddr(), streamType);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -292,7 +294,7 @@ int cellPamfReaderGetNumberOfSpecificStreams(mem_ptr_t<CellPamfReader> pSelf, u8
int cellPamfReaderSetStreamWithIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamIndex) int cellPamfReaderSetStreamWithIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamIndex)
{ {
cellPamf.Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)",
pSelf.GetAddr(), streamIndex); pSelf.GetAddr(), streamIndex);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -313,7 +315,7 @@ int cellPamfReaderSetStreamWithIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamI
int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, u8 streamType, u8 ch) int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t<CellPamfReader> 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); pSelf.GetAddr(), streamType, ch);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -323,7 +325,7 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, u
if (streamType > 5) 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 //it probably doesn't support "any audio" or "any video" argument
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -345,7 +347,7 @@ int cellPamfReaderSetStreamWithTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, u
int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamType, u8 streamIndex) int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t<CellPamfReader> 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); pSelf.GetAddr(), streamType, streamIndex);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -396,7 +398,7 @@ int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t<CellPamfReader> pSelf, u8
int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> pEsFilterId) int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId> 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()); type, ch, pEsFilterId.GetAddr());
if (!pEsFilterId.IsGood()) if (!pEsFilterId.IsGood())
@ -407,7 +409,7 @@ int cellPamfStreamTypeToEsFilterId(u8 type, u8 ch, mem_ptr_t<CellCodecEsFilterId
int cellPamfReaderGetStreamIndex(mem_ptr_t<CellPamfReader> pSelf) int cellPamfReaderGetStreamIndex(mem_ptr_t<CellPamfReader> pSelf)
{ {
cellPamf.Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr()); cellPamf->Log("cellPamfReaderGetStreamIndex(pSelf=0x%x)", pSelf.GetAddr());
if (!pSelf.IsGood()) if (!pSelf.IsGood())
return CELL_PAMF_ERROR_INVALID_ARG; return CELL_PAMF_ERROR_INVALID_ARG;
@ -417,7 +419,7 @@ int cellPamfReaderGetStreamIndex(mem_ptr_t<CellPamfReader> pSelf)
int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, mem8_t pType, mem8_t pCh) int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t<CellPamfReader> 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()); pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr());
if (!pSelf.IsGood() || !pCh.IsGood()) if (!pSelf.IsGood() || !pCh.IsGood())
@ -430,7 +432,7 @@ int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, mem8_
int cellPamfReaderGetEsFilterId(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecEsFilterId> pEsFilterId) int cellPamfReaderGetEsFilterId(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecEsFilterId> 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()); pSelf.GetAddr(), pSelf->stream, pEsFilterId.GetAddr());
if (!pSelf.IsGood() || !pEsFilterId.IsGood()) if (!pSelf.IsGood() || !pEsFilterId.IsGood())
@ -442,7 +444,7 @@ int cellPamfReaderGetEsFilterId(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellC
int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr, u32 size) int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> 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); pSelf.GetAddr(), pSelf->stream, pInfo_addr, size);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -461,7 +463,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
if (size != sizeof(CellPamfAvcInfo)) 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; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -481,13 +483,13 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
pInfo->matrixCoefficients = 1; //fake pInfo->matrixCoefficients = 1; //fake
//pInfo->deblockingFilterFlag = 1; //??? //pInfo->deblockingFilterFlag = 1; //???
cellPamf.Warning("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_AVC"); cellPamf->Warning("cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_AVC");
} }
break; break;
case CELL_PAMF_STREAM_TYPE_M2V: case CELL_PAMF_STREAM_TYPE_M2V:
{ {
//TODO //TODO
cellPamf.Error("TODO: cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_M2V"); cellPamf->Error("TODO: cellPamfReaderGetStreamInfo: CELL_PAMF_STREAM_TYPE_M2V");
} }
break; break;
case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS: case CELL_PAMF_STREAM_TYPE_ATRAC3PLUS:
@ -497,7 +499,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
if (size != sizeof(CellPamfAtrac3plusInfo)) 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; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -512,7 +514,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
if (size != sizeof(CellPamfAc3Info)) 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; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -527,7 +529,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
if (size != sizeof(CellPamfLpcmInfo)) 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; return CELL_PAMF_ERROR_INVALID_ARG;
} }
@ -538,12 +540,12 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
pInfo->bitsPerSample = CELL_PAMF_BIT_LENGTH_16; pInfo->bitsPerSample = CELL_PAMF_BIT_LENGTH_16;
else else
//TODO: CELL_PAMF_BIT_LENGTH_24 //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; break;
case CELL_PAMF_STREAM_TYPE_USER_DATA: 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; return CELL_PAMF_ERROR_INVALID_ARG;
} }
} }
@ -553,7 +555,7 @@ int cellPamfReaderGetStreamInfo(mem_ptr_t<CellPamfReader> pSelf, u32 pInfo_addr,
int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf) int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf)
{ {
cellPamf.Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))", cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))",
pSelf.GetAddr(), pSelf->stream); pSelf.GetAddr(), pSelf->stream);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -565,7 +567,7 @@ int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf)
int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 epIndex, mem_ptr_t<CellPamfEpIterator> pIt) int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 epIndex, mem_ptr_t<CellPamfEpIterator> 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()); pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr());
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
@ -578,7 +580,7 @@ int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 ep
int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp, mem_ptr_t<CellPamfEpIterator> pIt) int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp, mem_ptr_t<CellPamfEpIterator> 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()); pSelf.GetAddr(), pTimeStamp.GetAddr(), pIt.GetAddr());
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr); const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
@ -588,41 +590,42 @@ int cellPamfReaderGetEpIteratorWithTimeStamp(mem_ptr_t<CellPamfReader> pSelf, me
int cellPamfEpIteratorGetEp(mem_ptr_t<CellPamfEpIterator> pIt, mem_ptr_t<CellPamfEp> pEp) int cellPamfEpIteratorGetEp(mem_ptr_t<CellPamfEpIterator> pIt, mem_ptr_t<CellPamfEp> 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: //TODO:
return CELL_OK; return CELL_OK;
} }
int cellPamfEpIteratorMove(mem_ptr_t<CellPamfEpIterator> pIt, s32 steps, mem_ptr_t<CellPamfEp> pEp) int cellPamfEpIteratorMove(mem_ptr_t<CellPamfEpIterator> pIt, s32 steps, mem_ptr_t<CellPamfEp> 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: //TODO:
return CELL_OK; return CELL_OK;
} }
void cellPamf_init() void cellPamf_init()
{ {
cellPamf.AddFunc(0xca8181c1, cellPamfGetHeaderSize); cellPamf->AddFunc(0xca8181c1, cellPamfGetHeaderSize);
cellPamf.AddFunc(0x90fc9a59, cellPamfGetHeaderSize2); cellPamf->AddFunc(0x90fc9a59, cellPamfGetHeaderSize2);
cellPamf.AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize); cellPamf->AddFunc(0x44f5c9e3, cellPamfGetStreamOffsetAndSize);
cellPamf.AddFunc(0xd1a40ef4, cellPamfVerify); cellPamf->AddFunc(0xd1a40ef4, cellPamfVerify);
cellPamf.AddFunc(0xb8436ee5, cellPamfReaderInitialize); cellPamf->AddFunc(0xb8436ee5, cellPamfReaderInitialize);
cellPamf.AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime); cellPamf->AddFunc(0x4de501b1, cellPamfReaderGetPresentationStartTime);
cellPamf.AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime); cellPamf->AddFunc(0xf61609d6, cellPamfReaderGetPresentationEndTime);
cellPamf.AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound); cellPamf->AddFunc(0xdb70296c, cellPamfReaderGetMuxRateBound);
cellPamf.AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams); cellPamf->AddFunc(0x37f723f7, cellPamfReaderGetNumberOfStreams);
cellPamf.AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams); cellPamf->AddFunc(0xd0230671, cellPamfReaderGetNumberOfSpecificStreams);
cellPamf.AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex); cellPamf->AddFunc(0x461534b4, cellPamfReaderSetStreamWithIndex);
cellPamf.AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel); cellPamf->AddFunc(0x03fd2caa, cellPamfReaderSetStreamWithTypeAndChannel);
cellPamf.AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex); cellPamf->AddFunc(0x28b4e2c1, cellPamfReaderSetStreamWithTypeAndIndex);
cellPamf.AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId); cellPamf->AddFunc(0x01067e22, cellPamfStreamTypeToEsFilterId);
cellPamf.AddFunc(0x041cc708, cellPamfReaderGetStreamIndex); cellPamf->AddFunc(0x041cc708, cellPamfReaderGetStreamIndex);
cellPamf.AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel); cellPamf->AddFunc(0x9ab20793, cellPamfReaderGetStreamTypeAndChannel);
cellPamf.AddFunc(0x71df326a, cellPamfReaderGetEsFilterId); cellPamf->AddFunc(0x71df326a, cellPamfReaderGetEsFilterId);
cellPamf.AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo); cellPamf->AddFunc(0x67fd273b, cellPamfReaderGetStreamInfo);
cellPamf.AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp); cellPamf->AddFunc(0xd9ea3457, cellPamfReaderGetNumberOfEp);
cellPamf.AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex); cellPamf->AddFunc(0xe8586ec6, cellPamfReaderGetEpIteratorWithIndex);
cellPamf.AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp); cellPamf->AddFunc(0x439fba17, cellPamfReaderGetEpIteratorWithTimeStamp);
cellPamf.AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp); cellPamf->AddFunc(0x1abeb9d6, cellPamfEpIteratorGetEp);
cellPamf.AddFunc(0x50b83205, cellPamfEpIteratorMove); cellPamf->AddFunc(0x50b83205, cellPamfEpIteratorMove);
} }

View file

@ -9,8 +9,9 @@
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
#include <map> #include <map>
void cellPngDec_init(); //void cellPngDec_init();
Module cellPngDec(0x0018, cellPngDec_init); //Module cellPngDec(0x0018, cellPngDec_init);
extern Module *cellPngDec = nullptr;
static std::map<u32, CellPngDecMainHandle *> cellPngDecMap; static std::map<u32, CellPngDecMainHandle *> cellPngDecMap;
@ -23,7 +24,7 @@ CellPngDecMainHandle *getCellPngDecCtx(u32 mainHandle) {
int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam) 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; CellPngDecMainHandle *ctx = new CellPngDecMainHandle;
if (cellPngDecMap.find(mainHandle) != cellPngDecMap.end()) { if (cellPngDecMap.find(mainHandle) != cellPngDecMap.end()) {
delete cellPngDecMap[mainHandle]; delete cellPngDecMap[mainHandle];
@ -39,10 +40,10 @@ int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
int cellPngDecDestroy(u32 mainHandle) int cellPngDecDestroy(u32 mainHandle)
{ {
cellPngDec.Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle); cellPngDec->Warning("cellPngDecDestroy(mainHandle=0x%x)", mainHandle);
CellPngDecMainHandle *ctx = getCellPngDecCtx(mainHandle); CellPngDecMainHandle *ctx = getCellPngDecCtx(mainHandle);
if (!ctx) { if (!ctx) {
cellPngDec.Warning("cellPngDecDestroy(mainHandle=0x%x): bad handle", mainHandle); cellPngDec->Warning("cellPngDecDestroy(mainHandle=0x%x): bad handle", mainHandle);
return -1; return -1;
} }
@ -54,7 +55,7 @@ int cellPngDecDestroy(u32 mainHandle)
int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> src, u32 openInfo) int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> 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); mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
if (!subHandle.IsGood() || !src.IsGood()) if (!subHandle.IsGood() || !src.IsGood())
@ -87,17 +88,17 @@ int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> s
} }
// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. // 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; return CELL_OK;
} }
int cellPngDecClose(u32 mainHandle, u32 subHandle) 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; CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data)) if(!cellPngDec->CheckId(subHandle, subHandle_data))
return CELL_PNGDEC_ERROR_FATAL; return CELL_PNGDEC_ERROR_FATAL;
cellFsClose(subHandle_data->fd); cellFsClose(subHandle_data->fd);
@ -111,9 +112,9 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo
if (!info.IsGood()) if (!info.IsGood())
return CELL_PNGDEC_ERROR_ARG; return CELL_PNGDEC_ERROR_ARG;
cellPngDec.Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr()); cellPngDec->Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
CellPngDecSubHandle* subHandle_data; CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data)) if(!cellPngDec->CheckId(subHandle, subHandle_data))
return CELL_PNGDEC_ERROR_FATAL; return CELL_PNGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; 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; dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
CellPngDecSubHandle* subHandle_data; CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data)) if(!cellPngDec->CheckId(subHandle, subHandle_data))
return CELL_PNGDEC_ERROR_FATAL; return CELL_PNGDEC_ERROR_FATAL;
const u32& fd = subHandle_data->fd; 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) switch((u32)current_outParam.outputColorSpace)
{ {
case CELL_PNGDEC_RGB: case CELL_PNGDEC_RGB:
image_size = width * height;
case CELL_PNGDEC_RGBA: case CELL_PNGDEC_RGBA:
{ {
const char nComponents = current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3; 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_GRAYSCALE:
case CELL_PNGDEC_PALETTE: case CELL_PNGDEC_PALETTE:
case CELL_PNGDEC_GRAYSCALE_ALPHA: 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; break;
default: default:
@ -296,7 +298,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPn
return CELL_PNGDEC_ERROR_ARG; return CELL_PNGDEC_ERROR_ARG;
CellPngDecSubHandle* subHandle_data; CellPngDecSubHandle* subHandle_data;
if(!cellPngDec.CheckId(subHandle, subHandle_data)) if(!cellPngDec->CheckId(subHandle, subHandle_data))
return CELL_PNGDEC_ERROR_FATAL; return CELL_PNGDEC_ERROR_FATAL;
CellPngDecInfo& current_info = subHandle_data->info; CellPngDecInfo& current_info = subHandle_data->info;
@ -333,34 +335,34 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPn
void cellPngDec_init() void cellPngDec_init()
{ {
cellPngDec.AddFunc(0x157d30c5, cellPngDecCreate); cellPngDec->AddFunc(0x157d30c5, cellPngDecCreate);
cellPngDec.AddFunc(0x820dae1a, cellPngDecDestroy); cellPngDec->AddFunc(0x820dae1a, cellPngDecDestroy);
cellPngDec.AddFunc(0xd2bc5bfd, cellPngDecOpen); cellPngDec->AddFunc(0xd2bc5bfd, cellPngDecOpen);
cellPngDec.AddFunc(0x5b3d1ff1, cellPngDecClose); cellPngDec->AddFunc(0x5b3d1ff1, cellPngDecClose);
cellPngDec.AddFunc(0x9ccdcc95, cellPngDecReadHeader); cellPngDec->AddFunc(0x9ccdcc95, cellPngDecReadHeader);
cellPngDec.AddFunc(0x2310f155, cellPngDecDecodeData); cellPngDec->AddFunc(0x2310f155, cellPngDecDecodeData);
cellPngDec.AddFunc(0xe97c9bd4, cellPngDecSetParameter); cellPngDec->AddFunc(0xe97c9bd4, cellPngDecSetParameter);
/*cellPngDec.AddFunc(0x48436b2d, cellPngDecExtCreate); /*cellPngDec->AddFunc(0x48436b2d, cellPngDecExtCreate);
cellPngDec.AddFunc(0x0c515302, cellPngDecExtOpen); cellPngDec->AddFunc(0x0c515302, cellPngDecExtOpen);
cellPngDec.AddFunc(0x8b33f863, cellPngDecExtReadHeader); cellPngDec->AddFunc(0x8b33f863, cellPngDecExtReadHeader);
cellPngDec.AddFunc(0x726fc1d0, cellPngDecExtDecodeData); cellPngDec->AddFunc(0x726fc1d0, cellPngDecExtDecodeData);
cellPngDec.AddFunc(0x9e9d7d42, cellPngDecExtSetParameter); cellPngDec->AddFunc(0x9e9d7d42, cellPngDecExtSetParameter);
cellPngDec.AddFunc(0x7585a275, cellPngDecGetbKGD); cellPngDec->AddFunc(0x7585a275, cellPngDecGetbKGD);
cellPngDec.AddFunc(0x7a062d26, cellPngDecGetcHRM); cellPngDec->AddFunc(0x7a062d26, cellPngDecGetcHRM);
cellPngDec.AddFunc(0xb153629c, cellPngDecGetgAMA); cellPngDec->AddFunc(0xb153629c, cellPngDecGetgAMA);
cellPngDec.AddFunc(0xb905ebb7, cellPngDecGethIST); cellPngDec->AddFunc(0xb905ebb7, cellPngDecGethIST);
cellPngDec.AddFunc(0xf44b6c30, cellPngDecGetiCCP); cellPngDec->AddFunc(0xf44b6c30, cellPngDecGetiCCP);
cellPngDec.AddFunc(0x27c921b5, cellPngDecGetoFFs); cellPngDec->AddFunc(0x27c921b5, cellPngDecGetoFFs);
cellPngDec.AddFunc(0xb4fe75e1, cellPngDecGetpCAL); cellPngDec->AddFunc(0xb4fe75e1, cellPngDecGetpCAL);
cellPngDec.AddFunc(0x3d50016a, cellPngDecGetpHYs); cellPngDec->AddFunc(0x3d50016a, cellPngDecGetpHYs);
cellPngDec.AddFunc(0x30cb334a, cellPngDecGetsBIT); cellPngDec->AddFunc(0x30cb334a, cellPngDecGetsBIT);
cellPngDec.AddFunc(0xc41e1198, cellPngDecGetsCAL); cellPngDec->AddFunc(0xc41e1198, cellPngDecGetsCAL);
cellPngDec.AddFunc(0xa5cdf57e, cellPngDecGetsPLT); cellPngDec->AddFunc(0xa5cdf57e, cellPngDecGetsPLT);
cellPngDec.AddFunc(0xe4416e82, cellPngDecGetsRGB); cellPngDec->AddFunc(0xe4416e82, cellPngDecGetsRGB);
cellPngDec.AddFunc(0x35a6846c, cellPngDecGettIME); cellPngDec->AddFunc(0x35a6846c, cellPngDecGettIME);
cellPngDec.AddFunc(0xb96fb26e, cellPngDecGettRNS); cellPngDec->AddFunc(0xb96fb26e, cellPngDecGettRNS);
cellPngDec.AddFunc(0xe163977f, cellPngDecGetPLTE); cellPngDec->AddFunc(0xe163977f, cellPngDecGetPLTE);
cellPngDec.AddFunc(0x609ec7d5, cellPngDecUnknownChunks); cellPngDec->AddFunc(0x609ec7d5, cellPngDecUnknownChunks);
cellPngDec.AddFunc(0xb40ca175, cellPngDecGetTextChunk);*/ cellPngDec->AddFunc(0xb40ca175, cellPngDecGetTextChunk);*/
} }

View file

@ -7,10 +7,11 @@
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
#include "cellResc.h" #include "cellResc.h"
void cellResc_init(); //void cellResc_init();
void cellResc_load(); //void cellResc_load();
void cellResc_unload(); //void cellResc_unload();
Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload); //Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload);
Module *cellResc = nullptr;
// Error Codes // Error Codes
enum enum
@ -419,16 +420,16 @@ void InitVertex(mem_ptr_t<CellGcmContextData>& cntxt)
// Module Functions // Module Functions
int cellRescInit(mem_ptr_t<CellRescInitConfig> initConfig) int cellRescInit(mem_ptr_t<CellRescInitConfig> initConfig)
{ {
cellResc.Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.GetAddr()); cellResc->Warning("cellRescInit(initConfig_addr=0x%x)", initConfig.GetAddr());
if (s_rescInternalInstance->m_bInitialized) if (s_rescInternalInstance->m_bInitialized)
{ {
cellResc.Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED"); cellResc->Error("cellRescInit : CELL_RESC_ERROR_REINITIALIZED");
return CELL_RESC_ERROR_REINITIALIZED; return CELL_RESC_ERROR_REINITIALIZED;
} }
if (!initConfig.IsGood() || InternalVersion(initConfig.GetAddr()) == -1 || !CheckInitConfig(initConfig)) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -441,11 +442,11 @@ int cellRescInit(mem_ptr_t<CellRescInitConfig> initConfig)
void cellRescExit() void cellRescExit()
{ {
cellResc.Warning("cellRescExit()"); cellResc->Warning("cellRescExit()");
if(!s_rescInternalInstance->m_bInitialized) if(!s_rescInternalInstance->m_bInitialized)
{ {
cellResc.Error("cellRescExit()"); cellResc->Error("cellRescExit()");
return; return;
} }
@ -456,11 +457,11 @@ void cellRescExit()
int cellRescVideoOutResolutionId2RescBufferMode(u32 resolutionId, mem32_t bufferMode) 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()) 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; 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_480: bufferMode = CELL_RESC_720x480; break;
case CELL_VIDEO_OUT_RESOLUTION_576: bufferMode = CELL_RESC_720x576; break; case CELL_VIDEO_OUT_RESOLUTION_576: bufferMode = CELL_RESC_720x576; break;
default: default:
cellResc.Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT"); cellResc->Error("cellRescVideoOutResolutionId2RescBufferMod : CELL_RESC_ERROR_BAD_ARGUMENT");
return 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<CellRescDsts> dsts) int cellRescSetDsts(u32 dstsMode, mem_ptr_t<CellRescDsts> 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) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if (!dsts.IsGood()) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) && if ((dstsMode != CELL_RESC_720x480) && (dstsMode != CELL_RESC_720x576) &&
(dstsMode != CELL_RESC_1280x720) && (dstsMode != CELL_RESC_1920x1080)) (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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -508,24 +509,24 @@ int cellRescSetDsts(u32 dstsMode, mem_ptr_t<CellRescDsts> dsts)
int cellRescSetDisplayMode(u32 displayMode) int cellRescSetDisplayMode(u32 displayMode)
{ {
cellResc.Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode); cellResc->Warning("cellRescSetDisplayMode(displayMode=%d)", displayMode);
if (!s_rescInternalInstance->m_bInitialized) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if (!(s_rescInternalInstance->m_initConfig.supportModes & displayMode)) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
if ((displayMode != CELL_RESC_720x480) && (displayMode != CELL_RESC_720x576) && if ((displayMode != CELL_RESC_720x480) && (displayMode != CELL_RESC_720x576) &&
(displayMode != CELL_RESC_1280x720) && (displayMode != CELL_RESC_1920x1080)) (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; 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) 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; return CELL_RESC_ERROR_BAD_COMBINATION;
} }
if(IsPal60Hsync() && s_rescInternalInstance->m_initConfig.flipMode==CELL_RESC_DISPLAY_VSYNC) 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; return CELL_RESC_ERROR_BAD_COMBINATION;
} }
@ -598,17 +599,17 @@ int cellRescSetDisplayMode(u32 displayMode)
int cellRescAdjustAspectRatio(float horizontal, float vertical) 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) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if((horizontal < 0.5f || 2.f < horizontal) || (vertical < 0.5f || 2.f < vertical)) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -628,17 +629,17 @@ int cellRescAdjustAspectRatio(float horizontal, float vertical)
int cellRescSetPalInterpolateDropFlexRatio(float ratio) int cellRescSetPalInterpolateDropFlexRatio(float ratio)
{ {
cellResc.Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio); cellResc->Warning("cellRescSetPalInterpolateDropFlexRatio(ratio=%f)", ratio);
if(!s_rescInternalInstance->m_bInitialized) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(ratio < 0.f || 1.f < ratio) 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; 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) 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) 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; 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) 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) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -702,11 +703,11 @@ int cellRescGetNumColorBuffers(u32 dstMode, u32 palTemporalMode, u32 reserved)
int cellRescGcmSurface2RescSrc(mem_ptr_t<CellGcmSurface> gcmSurface, mem_ptr_t<CellRescSrc> rescSrc) int cellRescGcmSurface2RescSrc(mem_ptr_t<CellGcmSurface> gcmSurface, mem_ptr_t<CellRescSrc> 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()) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -732,32 +733,32 @@ int cellRescGcmSurface2RescSrc(mem_ptr_t<CellGcmSurface> gcmSurface, mem_ptr_t<C
int cellRescSetSrc(s32 idx, mem_ptr_t<CellRescSrc> src) int cellRescSetSrc(s32 idx, mem_ptr_t<CellRescSrc> 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) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(idx < 0 || SRC_BUFFER_NUM <= idx || !src.IsGood()) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
if(src->width < 1 || 4096 < src->width || src->height < 1 || 4096 < src->height) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
cellResc.Log(" *** format=0x%x", src->format.ToLE()); cellResc->Log(" *** format=0x%x", src->format.ToLE());
cellResc.Log(" *** pitch=%d", src->pitch.ToLE()); cellResc->Log(" *** pitch=%d", src->pitch.ToLE());
cellResc.Log(" *** width=%d", src->width.ToLE()); cellResc->Log(" *** width=%d", src->width.ToLE());
cellResc.Log(" *** height=%d", src->height.ToLE()); cellResc->Log(" *** height=%d", src->height.ToLE());
cellResc.Log(" *** offset=0x%x", src->offset.ToLE()); cellResc->Log(" *** offset=0x%x", src->offset.ToLE());
//Emu.GetGSManager().GetRender().SetData(src.offset, 800, 600); //Emu.GetGSManager().GetRender().SetData(src.offset, 800, 600);
//Emu.GetGSManager().GetRender().Draw(); //Emu.GetGSManager().GetRender().Draw();
@ -770,17 +771,17 @@ int cellRescSetSrc(s32 idx, mem_ptr_t<CellRescSrc> src)
int cellRescSetConvertAndFlip(mem_ptr_t<CellGcmContextData> cntxt, s32 idx) int cellRescSetConvertAndFlip(mem_ptr_t<CellGcmContextData> 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) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(idx < 0 || SRC_BUFFER_NUM <= idx) 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; return CELL_RESC_ERROR_BAD_ARGUMENT;
} }
@ -800,7 +801,7 @@ int cellRescSetConvertAndFlip(mem_ptr_t<CellGcmContextData> cntxt, s32 idx)
int cellRescSetWaitFlip() int cellRescSetWaitFlip()
{ {
cellResc.Log("cellRescSetWaitFlip()"); cellResc->Log("cellRescSetWaitFlip()");
GSLockCurrent lock(GS_LOCK_WAIT_FLIP); // could stall on exit GSLockCurrent lock(GS_LOCK_WAIT_FLIP); // could stall on exit
return CELL_OK; return CELL_OK;
@ -808,17 +809,17 @@ int cellRescSetWaitFlip()
int cellRescSetBufferAddress(mem32_t colorBuffers, mem32_t vertexArray, mem32_t fragmentShader) 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) 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; return CELL_RESC_ERROR_NOT_INITIALIZED;
} }
if(!colorBuffers.IsGood() || !vertexArray.IsGood() || !fragmentShader.IsGood()) 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; 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 || vertexArray.GetAddr() % VERTEX_BUFFER_ALIGNMENT ||
fragmentShader.GetAddr() % FRAGMENT_SHADER_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; 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) 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)) if (handler_addr != 0 && !Memory.IsGoodAddr(handler_addr))
{ {
cellResc.Error("cellRescSetFlipHandler : CELL_EFAULT"); cellResc->Error("cellRescSetFlipHandler : CELL_EFAULT");
return CELL_EFAULT; return CELL_EFAULT;
} }
@ -873,14 +874,14 @@ int cellRescSetFlipHandler(u32 handler_addr)
void cellRescResetFlipStatus() void cellRescResetFlipStatus()
{ {
cellResc.Log("cellRescResetFlipStatus()"); cellResc->Log("cellRescResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 1; Emu.GetGSManager().GetRender().m_flip_status = 1;
} }
int cellRescGetFlipStatus() int cellRescGetFlipStatus()
{ {
cellResc.Log("cellRescGetFlipStatus()"); cellResc->Log("cellRescGetFlipStatus()");
return Emu.GetGSManager().GetRender().m_flip_status; return Emu.GetGSManager().GetRender().m_flip_status;
} }
@ -918,28 +919,28 @@ int cellRescCreateInterlaceTable()
void cellResc_init() void cellResc_init()
{ {
cellResc.AddFunc(0x25c107e6, cellRescSetConvertAndFlip); cellResc->AddFunc(0x25c107e6, cellRescSetConvertAndFlip);
cellResc.AddFunc(0x0d3c22ce, cellRescSetWaitFlip); cellResc->AddFunc(0x0d3c22ce, cellRescSetWaitFlip);
cellResc.AddFunc(0x2ea94661, cellRescSetFlipHandler); cellResc->AddFunc(0x2ea94661, cellRescSetFlipHandler);
cellResc.AddFunc(0x01220224, cellRescGcmSurface2RescSrc); cellResc->AddFunc(0x01220224, cellRescGcmSurface2RescSrc);
cellResc.AddFunc(0x0a2069c7, cellRescGetNumColorBuffers); cellResc->AddFunc(0x0a2069c7, cellRescGetNumColorBuffers);
cellResc.AddFunc(0x10db5b1a, cellRescSetDsts); cellResc->AddFunc(0x10db5b1a, cellRescSetDsts);
cellResc.AddFunc(0x129922a0, cellRescResetFlipStatus); cellResc->AddFunc(0x129922a0, cellRescResetFlipStatus);
cellResc.AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio); cellResc->AddFunc(0x19a2a967, cellRescSetPalInterpolateDropFlexRatio);
cellResc.AddFunc(0x1dd3c4cd, cellRescGetRegisterCount); cellResc->AddFunc(0x1dd3c4cd, cellRescGetRegisterCount);
cellResc.AddFunc(0x22ae06d8, cellRescAdjustAspectRatio); cellResc->AddFunc(0x22ae06d8, cellRescAdjustAspectRatio);
cellResc.AddFunc(0x23134710, cellRescSetDisplayMode); cellResc->AddFunc(0x23134710, cellRescSetDisplayMode);
cellResc.AddFunc(0x2ea3061e, cellRescExit); cellResc->AddFunc(0x2ea3061e, cellRescExit);
cellResc.AddFunc(0x516ee89e, cellRescInit); cellResc->AddFunc(0x516ee89e, cellRescInit);
cellResc.AddFunc(0x5a338cdb, cellRescGetBufferSize); cellResc->AddFunc(0x5a338cdb, cellRescGetBufferSize);
cellResc.AddFunc(0x66f5e388, cellRescGetLastFlipTime); cellResc->AddFunc(0x66f5e388, cellRescGetLastFlipTime);
cellResc.AddFunc(0x6cd0f95f, cellRescSetSrc); cellResc->AddFunc(0x6cd0f95f, cellRescSetSrc);
cellResc.AddFunc(0x7af8a37f, cellRescSetRegisterCount); cellResc->AddFunc(0x7af8a37f, cellRescSetRegisterCount);
cellResc.AddFunc(0x8107277c, cellRescSetBufferAddress); cellResc->AddFunc(0x8107277c, cellRescSetBufferAddress);
cellResc.AddFunc(0xc47c5c22, cellRescGetFlipStatus); cellResc->AddFunc(0xc47c5c22, cellRescGetFlipStatus);
cellResc.AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode); cellResc->AddFunc(0xd1ca0503, cellRescVideoOutResolutionId2RescBufferMode);
cellResc.AddFunc(0xd3758645, cellRescSetVBlankHandler); cellResc->AddFunc(0xd3758645, cellRescSetVBlankHandler);
cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable); cellResc->AddFunc(0xe0cef79e, cellRescCreateInterlaceTable);
} }
void cellResc_load() void cellResc_load()

View file

@ -8,8 +8,9 @@
#include "cellRtc.h" #include "cellRtc.h"
void cellRtc_init(); //void cellRtc_init();
Module cellRtc(0x0009, cellRtc_init); //Module cellRtc(0x0009, cellRtc_init);
Module *cellRtc = nullptr;
long convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years) 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<CellRtcTick> pTick) int cellRtcGetCurrentTick(mem_ptr_t<CellRtcTick> pTick)
{ {
cellRtc.Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.GetAddr()); cellRtc->Log("cellRtcGetCurrentTick(pTick=0x%x)", pTick.GetAddr());
if (!pTick.IsGood()) if (!pTick.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime unow = wxDateTime::UNow(); rDateTime unow = rDateTime::UNow();
pTick->tick = unow.GetTicks(); pTick->tick = unow.GetTicks();
return CELL_OK; return CELL_OK;
} }
int cellRtcGetCurrentClock(mem_ptr_t<CellRtcDateTime> pClock, s32 iTimeZone) int cellRtcGetCurrentClock(mem_ptr_t<CellRtcDateTime> 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()) if (!pClock.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime unow = wxDateTime::UNow(); rDateTime unow = rDateTime::UNow();
// Add time_zone as offset in minutes. // 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); unow.Add(tz);
pClock->year = unow.GetYear(wxDateTime::TZ::UTC); pClock->year = unow.GetYear(rDateTime::TZ::UTC);
pClock->month = unow.GetMonth(wxDateTime::TZ::UTC); pClock->month = unow.GetMonth(rDateTime::TZ::UTC);
pClock->day = unow.GetDay(wxDateTime::TZ::UTC); pClock->day = unow.GetDay(rDateTime::TZ::UTC);
pClock->hour = unow.GetHour(wxDateTime::TZ::UTC); pClock->hour = unow.GetHour(rDateTime::TZ::UTC);
pClock->minute = unow.GetMinute(wxDateTime::TZ::UTC); pClock->minute = unow.GetMinute(rDateTime::TZ::UTC);
pClock->second = unow.GetSecond(wxDateTime::TZ::UTC); pClock->second = unow.GetSecond(rDateTime::TZ::UTC);
pClock->microsecond = unow.GetMillisecond(wxDateTime::TZ::UTC) * 1000; pClock->microsecond = unow.GetMillisecond(rDateTime::TZ::UTC) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcGetCurrentClockLocalTime(mem_ptr_t<CellRtcDateTime> pClock) int cellRtcGetCurrentClockLocalTime(mem_ptr_t<CellRtcDateTime> pClock)
{ {
cellRtc.Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.GetAddr()); cellRtc->Log("cellRtcGetCurrentClockLocalTime(pClock=0x%x)", pClock.GetAddr());
if (!pClock.IsGood()) if (!pClock.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime unow = wxDateTime::UNow(); rDateTime unow = rDateTime::UNow();
pClock->year = unow.GetYear(wxDateTime::TZ::Local); pClock->year = unow.GetYear(rDateTime::TZ::Local);
pClock->month = unow.GetMonth(wxDateTime::TZ::Local); pClock->month = unow.GetMonth(rDateTime::TZ::Local);
pClock->day = unow.GetDay(wxDateTime::TZ::Local); pClock->day = unow.GetDay(rDateTime::TZ::Local);
pClock->hour = unow.GetHour(wxDateTime::TZ::Local); pClock->hour = unow.GetHour(rDateTime::TZ::Local);
pClock->minute = unow.GetMinute(wxDateTime::TZ::Local); pClock->minute = unow.GetMinute(rDateTime::TZ::Local);
pClock->second = unow.GetSecond(wxDateTime::TZ::Local); pClock->second = unow.GetSecond(rDateTime::TZ::Local);
pClock->microsecond = unow.GetMillisecond(wxDateTime::TZ::Local) * 1000; pClock->microsecond = unow.GetMillisecond(rDateTime::TZ::Local) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32 iTimeZone) int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Add time_zone as offset in minutes. // 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. // Get date from ticks + tz.
wxDateTime date = wxDateTime((time_t)pUtc->tick); rDateTime date = rDateTime((time_t)pUtc->tick);
date.Add(tz); date.Add(tz);
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). // 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); Memory.WriteString(pszDateTime_addr, str);
return CELL_OK; return CELL_OK;
@ -103,16 +104,16 @@ int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32
int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc) int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Get date from ticks. // 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). // 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); Memory.WriteString(pszDateTime_addr, str);
return CELL_OK; return CELL_OK;
@ -120,20 +121,20 @@ int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> p
int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32 iTimeZone) int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Add time_zone as offset in minutes. // 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. // Get date from ticks + tz.
wxDateTime date = wxDateTime((time_t)pUtc->tick); rDateTime date = rDateTime((time_t)pUtc->tick);
date.Add(tz); date.Add(tz);
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). // 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); Memory.WriteString(pszDateTime_addr, str);
return CELL_OK; return CELL_OK;
@ -141,16 +142,16 @@ int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc, s32
int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> pUtc) int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Get date from ticks. // 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). // 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); Memory.WriteString(pszDateTime_addr, str);
return CELL_OK; return CELL_OK;
@ -158,15 +159,15 @@ int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t<CellRtcTick> p
int cellRtcParseDateTime(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr) int cellRtcParseDateTime(mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Get date from formatted string. // Get date from formatted string.
wxDateTime date; rDateTime date;
const std::string& format = Memory.ReadString(pszDateTime_addr); const std::string& format = Memory.ReadString(pszDateTime_addr);
date.ParseDateTime(fmt::FromUTF8(format)); date.ParseDateTime(format);
pUtc->tick = date.GetTicks(); pUtc->tick = date.GetTicks();
@ -175,15 +176,15 @@ int cellRtcParseDateTime(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr)
int cellRtcParseRfc3339(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr) int cellRtcParseRfc3339(mem_ptr_t<CellRtcTick> 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)) if (!pUtc.IsGood() || !Memory.IsGoodAddr(pszDateTime_addr))
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Get date from RFC3339 formatted string. // Get date from RFC3339 formatted string.
wxDateTime date; rDateTime date;
const std::string& format = Memory.ReadString(pszDateTime_addr); const std::string& format = Memory.ReadString(pszDateTime_addr);
date.ParseDateTime(fmt::FromUTF8(format)); date.ParseDateTime(format);
pUtc->tick = date.GetTicks(); pUtc->tick = date.GetTicks();
@ -192,12 +193,12 @@ int cellRtcParseRfc3339(mem_ptr_t<CellRtcTick> pUtc, u32 pszDateTime_addr)
int cellRtcGetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> pTick) int cellRtcGetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> 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()) if (!pTime.IsGood() || !pTick.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; 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(); pTick->tick = datetime.GetTicks();
return CELL_OK; return CELL_OK;
@ -205,27 +206,27 @@ int cellRtcGetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> pTic
int cellRtcSetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> pTick) int cellRtcSetTick(mem_ptr_t<CellRtcDateTime> pTime, mem_ptr_t<CellRtcTick> 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()) if (!pTime.IsGood() || !pTick.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; 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->year = date.GetYear(rDateTime::TZ::UTC);
pTime->month = date.GetMonth(wxDateTime::TZ::UTC); pTime->month = date.GetMonth(rDateTime::TZ::UTC);
pTime->day = date.GetDay(wxDateTime::TZ::UTC); pTime->day = date.GetDay(rDateTime::TZ::UTC);
pTime->hour = date.GetHour(wxDateTime::TZ::UTC); pTime->hour = date.GetHour(rDateTime::TZ::UTC);
pTime->minute = date.GetMinute(wxDateTime::TZ::UTC); pTime->minute = date.GetMinute(rDateTime::TZ::UTC);
pTime->second = date.GetSecond(wxDateTime::TZ::UTC); pTime->second = date.GetSecond(rDateTime::TZ::UTC);
pTime->microsecond = date.GetMillisecond(wxDateTime::TZ::UTC) * 1000; pTime->microsecond = date.GetMillisecond(rDateTime::TZ::UTC) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcTickAddTicks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddTicks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
@ -236,13 +237,13 @@ int cellRtcTickAddTicks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
int cellRtcTickAddMicroseconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddMicroseconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxTimeSpan microseconds = wxTimeSpan(0, 0, 0, lAdd / 1000); rTimeSpan microseconds = rTimeSpan(0, 0, 0, lAdd / 1000);
date.Add(microseconds); date.Add(microseconds);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -251,13 +252,13 @@ int cellRtcTickAddMicroseconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcT
int cellRtcTickAddSeconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddSeconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxTimeSpan seconds = wxTimeSpan(0, 0, lAdd, 0); rTimeSpan seconds = rTimeSpan(0, 0, lAdd, 0);
date.Add(seconds); date.Add(seconds);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -266,13 +267,13 @@ int cellRtcTickAddSeconds(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick>
int cellRtcTickAddMinutes(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s64 lAdd) int cellRtcTickAddMinutes(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxTimeSpan minutes = wxTimeSpan(0, lAdd, 0, 0); rTimeSpan minutes = rTimeSpan(0, lAdd, 0, 0);
date.Add(minutes); date.Add(minutes);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -281,13 +282,13 @@ int cellRtcTickAddMinutes(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick>
int cellRtcTickAddHours(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddHours(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxTimeSpan hours = wxTimeSpan(iAdd, 0, 0, 0); rTimeSpan hours = rTimeSpan(iAdd, 0, 0, 0);
date.Add(hours); date.Add(hours);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -296,13 +297,13 @@ int cellRtcTickAddHours(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
int cellRtcTickAddDays(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddDays(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxDateSpan days = wxDateSpan(0, 0, 0, iAdd); rDateSpan days = rDateSpan(0, 0, 0, iAdd);
date.Add(days); date.Add(days);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -311,13 +312,13 @@ int cellRtcTickAddDays(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTi
int cellRtcTickAddWeeks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddWeeks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxDateSpan weeks = wxDateSpan(0, 0, iAdd, 0); rDateSpan weeks = rDateSpan(0, 0, iAdd, 0);
date.Add(weeks); date.Add(weeks);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -326,13 +327,13 @@ int cellRtcTickAddWeeks(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
int cellRtcTickAddMonths(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddMonths(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxDateSpan months = wxDateSpan(0, iAdd, 0, 0); rDateSpan months = rDateSpan(0, iAdd, 0, 0);
date.Add(months); date.Add(months);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -341,13 +342,13 @@ int cellRtcTickAddMonths(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> p
int cellRtcTickAddYears(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1, s32 iAdd) int cellRtcTickAddYears(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date = wxDateTime((time_t)pTick1->tick); rDateTime date = rDateTime((time_t)pTick1->tick);
wxDateSpan years = wxDateSpan(iAdd, 0, 0, 0); rDateSpan years = rDateSpan(iAdd, 0, 0, 0);
date.Add(years); date.Add(years);
pTick0->tick = date.GetTicks(); pTick0->tick = date.GetTicks();
@ -356,39 +357,39 @@ int cellRtcTickAddYears(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pT
int cellRtcConvertUtcToLocalTime(mem_ptr_t<CellRtcTick> pUtc, mem_ptr_t<CellRtcTick> pLocalTime) int cellRtcConvertUtcToLocalTime(mem_ptr_t<CellRtcTick> pUtc, mem_ptr_t<CellRtcTick> 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()) if (!pUtc.IsGood() || !pLocalTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime time = wxDateTime((time_t)pUtc->tick); rDateTime time = rDateTime((time_t)pUtc->tick);
wxDateTime local_time = time.FromUTC(false); rDateTime local_time = time.FromUTC(false);
pLocalTime->tick = local_time.GetTicks(); pLocalTime->tick = local_time.GetTicks();
return CELL_OK; return CELL_OK;
} }
int cellRtcConvertLocalTimeToUtc(mem_ptr_t<CellRtcTick> pLocalTime, mem_ptr_t<CellRtcTick> pUtc) int cellRtcConvertLocalTimeToUtc(mem_ptr_t<CellRtcTick> pLocalTime, mem_ptr_t<CellRtcTick> 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()) if (!pLocalTime.IsGood() || !pUtc.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime time = wxDateTime((time_t)pLocalTime->tick); rDateTime time = rDateTime((time_t)pLocalTime->tick);
wxDateTime utc_time = time.ToUTC(false); rDateTime utc_time = time.ToUTC(false);
pUtc->tick = utc_time.GetTicks(); pUtc->tick = utc_time.GetTicks();
return CELL_OK; return CELL_OK;
} }
int cellRtcGetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem32_t puiDosTime) int cellRtcGetDosTime(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood() || !puiDosTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Convert to DOS time. // 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(); puiDosTime = date_time.GetAsDOS();
return CELL_OK; return CELL_OK;
@ -396,123 +397,123 @@ int cellRtcGetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem32_t puiDosTime)
int cellRtcGetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t piTime) int cellRtcGetTime_t(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood() || !piTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Convert to POSIX time_t. // 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)); 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(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), piTime = convertToUNIXTime(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC));
return CELL_OK; return CELL_OK;
} }
int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t pulWin32FileTime) int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood() || !pulWin32FileTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
// Convert to WIN32 FILETIME. // 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)); 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(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC));
return CELL_OK; return CELL_OK;
} }
int cellRtcSetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, u32 uiDosTime) int cellRtcSetDosTime(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
wxDateTime date_time; rDateTime date_time;
wxDateTime dos_time = date_time.SetFromDOS(uiDosTime); rDateTime dos_time = date_time.SetFromDOS(uiDosTime);
pDateTime->year = dos_time.GetYear(wxDateTime::TZ::UTC); pDateTime->year = dos_time.GetYear(rDateTime::TZ::UTC);
pDateTime->month = dos_time.GetMonth(wxDateTime::TZ::UTC); pDateTime->month = dos_time.GetMonth(rDateTime::TZ::UTC);
pDateTime->day = dos_time.GetDay(wxDateTime::TZ::UTC); pDateTime->day = dos_time.GetDay(rDateTime::TZ::UTC);
pDateTime->hour = dos_time.GetHour(wxDateTime::TZ::UTC); pDateTime->hour = dos_time.GetHour(rDateTime::TZ::UTC);
pDateTime->minute = dos_time.GetMinute(wxDateTime::TZ::UTC); pDateTime->minute = dos_time.GetMinute(rDateTime::TZ::UTC);
pDateTime->second = dos_time.GetSecond(wxDateTime::TZ::UTC); pDateTime->second = dos_time.GetSecond(rDateTime::TZ::UTC);
pDateTime->microsecond = dos_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; pDateTime->microsecond = dos_time.GetMillisecond(rDateTime::TZ::UTC) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcSetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, u64 iTime) int cellRtcSetTime_t(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; 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->year = date_time.GetYear(rDateTime::TZ::UTC);
pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); pDateTime->month = date_time.GetMonth(rDateTime::TZ::UTC);
pDateTime->day = date_time.GetDay(wxDateTime::TZ::UTC); pDateTime->day = date_time.GetDay(rDateTime::TZ::UTC);
pDateTime->hour = date_time.GetHour(wxDateTime::TZ::UTC); pDateTime->hour = date_time.GetHour(rDateTime::TZ::UTC);
pDateTime->minute = date_time.GetMinute(wxDateTime::TZ::UTC); pDateTime->minute = date_time.GetMinute(rDateTime::TZ::UTC);
pDateTime->second = date_time.GetSecond(wxDateTime::TZ::UTC); pDateTime->second = date_time.GetSecond(rDateTime::TZ::UTC);
pDateTime->microsecond = date_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; pDateTime->microsecond = date_time.GetMillisecond(rDateTime::TZ::UTC) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcSetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, u64 ulWin32FileTime) int cellRtcSetWin32FileTime(mem_ptr_t<CellRtcDateTime> 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()) if (!pDateTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; 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->year = date_time.GetYear(rDateTime::TZ::UTC);
pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); pDateTime->month = date_time.GetMonth(rDateTime::TZ::UTC);
pDateTime->day = date_time.GetDay(wxDateTime::TZ::UTC); pDateTime->day = date_time.GetDay(rDateTime::TZ::UTC);
pDateTime->hour = date_time.GetHour(wxDateTime::TZ::UTC); pDateTime->hour = date_time.GetHour(rDateTime::TZ::UTC);
pDateTime->minute = date_time.GetMinute(wxDateTime::TZ::UTC); pDateTime->minute = date_time.GetMinute(rDateTime::TZ::UTC);
pDateTime->second = date_time.GetSecond(wxDateTime::TZ::UTC); pDateTime->second = date_time.GetSecond(rDateTime::TZ::UTC);
pDateTime->microsecond = date_time.GetMillisecond(wxDateTime::TZ::UTC) * 1000; pDateTime->microsecond = date_time.GetMillisecond(rDateTime::TZ::UTC) * 1000;
return CELL_OK; return CELL_OK;
} }
int cellRtcIsLeapYear(s32 year) int cellRtcIsLeapYear(s32 year)
{ {
cellRtc.Log("cellRtcIsLeapYear(year=%d)", year); cellRtc->Log("cellRtcIsLeapYear(year=%d)", year);
wxDateTime datetime; rDateTime datetime;
return datetime.IsLeapYear(year, wxDateTime::Gregorian); return datetime.IsLeapYear(year, rDateTime::Gregorian);
} }
int cellRtcGetDaysInMonth(s32 year, s32 month) 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; rDateTime datetime;
return datetime.GetNumberOfDays((wxDateTime::Month) month, year, wxDateTime::Gregorian); return datetime.GetNumberOfDays((rDateTime::Month) month, year, rDateTime::Gregorian);
} }
int cellRtcGetDayOfWeek(s32 year, s32 month, s32 day) 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; rDateTime datetime;
datetime.SetToWeekDay((wxDateTime::WeekDay) day, 1, (wxDateTime::Month) month, year); datetime.SetToWeekDay((rDateTime::WeekDay) day, 1, (rDateTime::Month) month, year);
return datetime.GetWeekDay(); return datetime.GetWeekDay();
} }
int cellRtcCheckValid(mem_ptr_t<CellRtcDateTime> pTime) int cellRtcCheckValid(mem_ptr_t<CellRtcDateTime> pTime)
{ {
cellRtc.Log("cellRtcCheckValid(pTime=0x%x)", pTime.GetAddr()); cellRtc->Log("cellRtcCheckValid(pTime=0x%x)", pTime.GetAddr());
if (!pTime.IsGood()) if (!pTime.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
@ -529,7 +530,7 @@ int cellRtcCheckValid(mem_ptr_t<CellRtcDateTime> pTime)
int cellRtcCompareTick(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTick1) int cellRtcCompareTick(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> 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()) if (!pTick0.IsGood() || !pTick1.IsGood())
return CELL_RTC_ERROR_INVALID_POINTER; return CELL_RTC_ERROR_INVALID_POINTER;
@ -541,44 +542,44 @@ int cellRtcCompareTick(mem_ptr_t<CellRtcTick> pTick0, mem_ptr_t<CellRtcTick> pTi
void cellRtc_init() void cellRtc_init()
{ {
cellRtc.AddFunc(0x9dafc0d9, cellRtcGetCurrentTick); cellRtc->AddFunc(0x9dafc0d9, cellRtcGetCurrentTick);
cellRtc.AddFunc(0x32c941cf, cellRtcGetCurrentClock); cellRtc->AddFunc(0x32c941cf, cellRtcGetCurrentClock);
cellRtc.AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime); cellRtc->AddFunc(0x2cce9cf5, cellRtcGetCurrentClockLocalTime);
cellRtc.AddFunc(0x5491b9d5, cellRtcFormatRfc2822); cellRtc->AddFunc(0x5491b9d5, cellRtcFormatRfc2822);
cellRtc.AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime); cellRtc->AddFunc(0xa07c3d2f, cellRtcFormatRfc2822LocalTime);
cellRtc.AddFunc(0xd9c0b463, cellRtcFormatRfc3339); cellRtc->AddFunc(0xd9c0b463, cellRtcFormatRfc3339);
cellRtc.AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime); cellRtc->AddFunc(0x1324948a, cellRtcFormatRfc3339LocalTime);
cellRtc.AddFunc(0xc5bc0fac, cellRtcParseDateTime); cellRtc->AddFunc(0xc5bc0fac, cellRtcParseDateTime);
cellRtc.AddFunc(0xcf11c3d6, cellRtcParseRfc3339); cellRtc->AddFunc(0xcf11c3d6, cellRtcParseRfc3339);
cellRtc.AddFunc(0xc7bdb7eb, cellRtcGetTick); cellRtc->AddFunc(0xc7bdb7eb, cellRtcGetTick);
cellRtc.AddFunc(0x99b13034, cellRtcSetTick); cellRtc->AddFunc(0x99b13034, cellRtcSetTick);
cellRtc.AddFunc(0x269a1882, cellRtcTickAddTicks); cellRtc->AddFunc(0x269a1882, cellRtcTickAddTicks);
cellRtc.AddFunc(0xf8509925, cellRtcTickAddMicroseconds); cellRtc->AddFunc(0xf8509925, cellRtcTickAddMicroseconds);
cellRtc.AddFunc(0xccce71bd, cellRtcTickAddSeconds); cellRtc->AddFunc(0xccce71bd, cellRtcTickAddSeconds);
cellRtc.AddFunc(0x2f010bfa, cellRtcTickAddMinutes); cellRtc->AddFunc(0x2f010bfa, cellRtcTickAddMinutes);
cellRtc.AddFunc(0xd41d3bd2, cellRtcTickAddHours); cellRtc->AddFunc(0xd41d3bd2, cellRtcTickAddHours);
cellRtc.AddFunc(0x75744e2a, cellRtcTickAddDays); cellRtc->AddFunc(0x75744e2a, cellRtcTickAddDays);
cellRtc.AddFunc(0x64c63fd5, cellRtcTickAddWeeks); cellRtc->AddFunc(0x64c63fd5, cellRtcTickAddWeeks);
cellRtc.AddFunc(0xe0ecbb45, cellRtcTickAddMonths); cellRtc->AddFunc(0xe0ecbb45, cellRtcTickAddMonths);
cellRtc.AddFunc(0x332a74dd, cellRtcTickAddYears); cellRtc->AddFunc(0x332a74dd, cellRtcTickAddYears);
cellRtc.AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime); cellRtc->AddFunc(0xc48d5002, cellRtcConvertUtcToLocalTime);
cellRtc.AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc); cellRtc->AddFunc(0x46ca7fe0, cellRtcConvertLocalTimeToUtc);
// (TODO: Time Information Manipulation Functions missing) // (TODO: Time Information Manipulation Functions missing)
cellRtc.AddFunc(0xdfff32cf, cellRtcGetDosTime); cellRtc->AddFunc(0xdfff32cf, cellRtcGetDosTime);
cellRtc.AddFunc(0xcb90c761, cellRtcGetTime_t); cellRtc->AddFunc(0xcb90c761, cellRtcGetTime_t);
cellRtc.AddFunc(0xe7086f05, cellRtcGetWin32FileTime); cellRtc->AddFunc(0xe7086f05, cellRtcGetWin32FileTime);
cellRtc.AddFunc(0x9598d4b3, cellRtcSetDosTime); cellRtc->AddFunc(0x9598d4b3, cellRtcSetDosTime);
cellRtc.AddFunc(0xbb543189, cellRtcSetTime_t); cellRtc->AddFunc(0xbb543189, cellRtcSetTime_t);
cellRtc.AddFunc(0x5f68c268, cellRtcSetWin32FileTime); cellRtc->AddFunc(0x5f68c268, cellRtcSetWin32FileTime);
cellRtc.AddFunc(0x5316b4a8, cellRtcIsLeapYear); cellRtc->AddFunc(0x5316b4a8, cellRtcIsLeapYear);
cellRtc.AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth); cellRtc->AddFunc(0x5b6a0a1d, cellRtcGetDaysInMonth);
cellRtc.AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek); cellRtc->AddFunc(0xc2d8cf95, cellRtcGetDayOfWeek);
cellRtc.AddFunc(0x7f1086e6, cellRtcCheckValid); cellRtc->AddFunc(0x7f1086e6, cellRtcCheckValid);
cellRtc.AddFunc(0xfb51fc61, cellRtcCompareTick); cellRtc->AddFunc(0xfb51fc61, cellRtcCompareTick);
} }

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,9 @@
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
void cellSync_init(); //void cellSync_init();
Module cellSync("cellSync", cellSync_init); //Module cellSync("cellSync", cellSync_init);
Module *cellSync = nullptr;
// Return Codes // Return Codes
enum enum
@ -47,7 +48,7 @@ static_assert(sizeof(CellSyncMutex) == 4, "CellSyncMutex: wrong sizeof");
int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex) int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
{ {
cellSync.Log("cellSyncMutexInitialize(mutex=0x%x)", mutex.GetAddr()); cellSync->Log("cellSyncMutexInitialize(mutex=0x%x)", mutex.GetAddr());
if (!mutex.IsGood()) if (!mutex.IsGood())
{ {
@ -64,7 +65,7 @@ int cellSyncMutexInitialize(mem_ptr_t<CellSyncMutex> mutex)
int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex) int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
{ {
cellSync.Log("cellSyncMutexLock(mutex=0x%x)", mutex.GetAddr()); cellSync->Log("cellSyncMutexLock(mutex=0x%x)", mutex.GetAddr());
if (!mutex.IsGood()) if (!mutex.IsGood())
{ {
@ -102,7 +103,7 @@ int cellSyncMutexLock(mem_ptr_t<CellSyncMutex> mutex)
int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex) int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
{ {
cellSync.Log("cellSyncMutexTryLock(mutex=0x%x)", mutex.GetAddr()); cellSync->Log("cellSyncMutexTryLock(mutex=0x%x)", mutex.GetAddr());
if (!mutex.IsGood()) if (!mutex.IsGood())
{ {
@ -138,7 +139,7 @@ int cellSyncMutexTryLock(mem_ptr_t<CellSyncMutex> mutex)
int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex) int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
{ {
cellSync.Log("cellSyncMutexUnlock(mutex=0x%x)", mutex.GetAddr()); cellSync->Log("cellSyncMutexUnlock(mutex=0x%x)", mutex.GetAddr());
if (!mutex.IsGood()) if (!mutex.IsGood())
{ {
@ -164,8 +165,8 @@ int cellSyncMutexUnlock(mem_ptr_t<CellSyncMutex> mutex)
void cellSync_init() void cellSync_init()
{ {
cellSync.AddFunc(0xa9072dee, cellSyncMutexInitialize); cellSync->AddFunc(0xa9072dee, cellSyncMutexInitialize);
cellSync.AddFunc(0x1bb675c2, cellSyncMutexLock); cellSync->AddFunc(0x1bb675c2, cellSyncMutexLock);
cellSync.AddFunc(0xd06918c4, cellSyncMutexTryLock); cellSync->AddFunc(0xd06918c4, cellSyncMutexTryLock);
cellSync.AddFunc(0x91f2b7b0, cellSyncMutexUnlock); cellSync->AddFunc(0x91f2b7b0, cellSyncMutexUnlock);
} }

View file

@ -4,10 +4,12 @@
#include "Emu/System.h" #include "Emu/System.h"
#include "Emu/Cell/PPUThread.h" #include "Emu/Cell/PPUThread.h"
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/ModuleManager.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
void cellSysmodule_init(); //void cellSysmodule_init();
Module cellSysmodule("cellSysmodule", cellSysmodule_init); //Module cellSysmodule("cellSysmodule", cellSysmodule_init);
Module *cellSysmodule = nullptr;
enum enum
{ {
@ -144,19 +146,19 @@ const char *getModuleName(int id) {
int cellSysmoduleInitialize() int cellSysmoduleInitialize()
{ {
cellSysmodule.Log("cellSysmoduleInitialize()"); cellSysmodule->Log("cellSysmoduleInitialize()");
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleFinalize() int cellSysmoduleFinalize()
{ {
cellSysmodule.Log("cellSysmoduleFinalize()"); cellSysmodule->Log("cellSysmoduleFinalize()");
return CELL_OK; return CELL_OK;
} }
int cellSysmoduleSetMemcontainer(u32 ct_id) 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; return CELL_OK;
} }
@ -164,10 +166,10 @@ int cellSysmoduleLoadModule(u16 id)
{ {
if (id == 0xf054) if (id == 0xf054)
{ {
cellSysmodule.Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI"); cellSysmodule->Error("cellSysmoduleLoadModule: TODO: CELL_SYSMODULE_LIBATRAC3MULTI");
} }
cellSysmodule.Warning("cellSysmoduleLoadModule(%s)", getModuleName(id)); cellSysmodule->Warning("cellSysmoduleLoadModule(%s)", getModuleName(id));
Module* m = GetModuleById(id); Module* m = Emu.GetModuleManager().GetModuleById(id);
if(!m) if(!m)
{ {
@ -185,8 +187,8 @@ int cellSysmoduleLoadModule(u16 id)
int cellSysmoduleUnloadModule(u16 id) int cellSysmoduleUnloadModule(u16 id)
{ {
cellSysmodule.Warning("cellSysmoduleUnloadModule(%s)", getModuleName(id)); cellSysmodule->Warning("cellSysmoduleUnloadModule(%s)", getModuleName(id));
Module* m = GetModuleById(id); Module* m = Emu.GetModuleManager().GetModuleById(id);
if(!m) if(!m)
{ {
@ -204,8 +206,8 @@ int cellSysmoduleUnloadModule(u16 id)
int cellSysmoduleIsLoaded(u16 id) int cellSysmoduleIsLoaded(u16 id)
{ {
cellSysmodule.Warning("cellSysmoduleIsLoaded(%s)", getModuleName(id)); cellSysmodule->Warning("cellSysmoduleIsLoaded(%s)", getModuleName(id));
Module* m = GetModuleById(id); Module* m = Emu.GetModuleManager().GetModuleById(id);
if(!m) if(!m)
{ {
@ -217,10 +219,10 @@ int cellSysmoduleIsLoaded(u16 id)
void cellSysmodule_init() void cellSysmodule_init()
{ {
cellSysmodule.AddFunc(0x63ff6ff9, cellSysmoduleInitialize); cellSysmodule->AddFunc(0x63ff6ff9, cellSysmoduleInitialize);
cellSysmodule.AddFunc(0x96c07adf, cellSysmoduleFinalize); cellSysmodule->AddFunc(0x96c07adf, cellSysmoduleFinalize);
cellSysmodule.AddFunc(0xa193143c, cellSysmoduleSetMemcontainer); cellSysmodule->AddFunc(0xa193143c, cellSysmoduleSetMemcontainer);
cellSysmodule.AddFunc(0x32267a31, cellSysmoduleLoadModule); cellSysmodule->AddFunc(0x32267a31, cellSysmoduleLoadModule);
cellSysmodule.AddFunc(0x112a5ee9, cellSysmoduleUnloadModule); cellSysmodule->AddFunc(0x112a5ee9, cellSysmoduleUnloadModule);
cellSysmodule.AddFunc(0x5a59e258, cellSysmoduleIsLoaded); cellSysmodule->AddFunc(0x5a59e258, cellSysmoduleIsLoaded);
} }

View file

@ -17,12 +17,13 @@ typedef void (*CellMsgDialogCallback)(int buttonType, mem_ptr_t<void> userData);
typedef void (*CellHddGameStatCallback)(mem_ptr_t<CellHddGameCBResult> cbResult, mem_ptr_t<CellHddGameStatGet> get, mem_ptr_t<CellHddGameStatSet> set); typedef void (*CellHddGameStatCallback)(mem_ptr_t<CellHddGameCBResult> cbResult, mem_ptr_t<CellHddGameStatGet> get, mem_ptr_t<CellHddGameStatSet> set);
void cellSysutil_init(); //void cellSysutil_init();
Module cellSysutil(0x0015, cellSysutil_init); //Module cellSysutil(0x0015, cellSysutil_init);
Module *cellSysutil;
int cellSysutilGetSystemParamInt(int id, mem32_t value) 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()) if(!value.IsGood())
{ {
@ -32,77 +33,77 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value)
switch(id) switch(id)
{ {
case CELL_SYSUTIL_SYSTEMPARAM_ID_LANG: 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(); value = Ini.SysLanguage.GetValue();
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN: 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; value = CELL_SYSUTIL_ENTER_BUTTON_ASSIGN_CROSS;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_DATE_FORMAT: 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; value = CELL_SYSUTIL_DATE_FMT_DDMMYYYY;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIME_FORMAT: 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; value = CELL_SYSUTIL_TIME_FMT_CLOCK24;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE"); cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE");
value = 3; value = 3;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME:
cellSysutil.Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME"); cellSysutil->Warning("cellSysutilGetSystemParamInt: CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME");
value = 1; value = 1;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: 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; value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: 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; value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: 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; value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: 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; value = CELL_SYSUTIL_CAMERA_PLFREQ_DISABLED;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_RUMBLE: 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; value = CELL_SYSUTIL_PAD_RUMBLE_OFF;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_KEYBOARD_TYPE: 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; value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: 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; value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: 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; value = 0;
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: 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; value = 0;
break; break;
@ -115,7 +116,7 @@ int cellSysutilGetSystemParamInt(int id, mem32_t value)
int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> buf, u32 bufsize) int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> 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()) if (!buf.IsGood())
return CELL_EFAULT; return CELL_EFAULT;
@ -125,12 +126,12 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> buf, u32 bufsize)
switch(id) switch(id)
{ {
case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: 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 memcpy(buf, "Unknown", 8); //for example
break; break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: 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); memcpy(buf, "Unknown", 8);
break; break;
@ -143,7 +144,7 @@ int cellSysutilGetSystemParamString(s32 id, mem_list_ptr_t<u8> buf, u32 bufsize)
int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr) 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; 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<CellVideoOutResolution> resolution) int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution> resolution)
{ {
cellSysutil.Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)", cellSysutil->Log("cellVideoOutGetResolution(resolutionId=%d, resolution_addr=0x%x)",
resolutionId, resolution.GetAddr()); resolutionId, resolution.GetAddr());
if (!resolution.IsGood()) if (!resolution.IsGood())
@ -199,7 +200,7 @@ int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution
int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent) int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent)
{ {
cellSysutil.Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)", cellSysutil->Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)",
videoOut, config_addr, option_addr, waitForEvent); videoOut, config_addr, option_addr, waitForEvent);
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) 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) 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); videoOut, config_addr, option_addr);
if(!Memory.IsGoodAddr(config_addr, sizeof(CellVideoOutConfiguration))) return CELL_EFAULT; 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<CellVideoOutDeviceInfo> info) int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_ptr_t<CellVideoOutDeviceInfo> 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()); videoOut, deviceIndex, info.GetAddr());
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;
@ -303,7 +304,7 @@ int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, mem_ptr_t<CellVideo
int cellVideoOutGetNumberOfDevice(u32 videoOut) int cellVideoOutGetNumberOfDevice(u32 videoOut)
{ {
cellSysutil.Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut); cellSysutil->Warning("cellVideoOutGetNumberOfDevice(videoOut=%d)", videoOut);
switch(videoOut) switch(videoOut)
{ {
@ -316,7 +317,7 @@ int cellVideoOutGetNumberOfDevice(u32 videoOut)
int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option) 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); videoOut, resolutionId, aspect, option);
if(!ResolutionIdToNum(resolutionId)) if(!ResolutionIdToNum(resolutionId))
@ -338,7 +339,7 @@ extern std::atomic<u32> g_FsAioReadCur;
int cellSysutilCheckCallback() int cellSysutilCheckCallback()
{ {
cellSysutil.Log("cellSysutilCheckCallback()"); cellSysutil->Log("cellSysutilCheckCallback()");
Emu.GetCallbackManager().m_exit_callback.Check(); Emu.GetCallbackManager().m_exit_callback.Check();
@ -359,22 +360,22 @@ int cellSysutilCheckCallback()
int cellSysutilRegisterCallback(int slot, u64 func_addr, u64 userdata) 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); Emu.GetCallbackManager().m_exit_callback.Register(slot, func_addr, userdata);
wxGetApp().SendDbgCommand(DID_REGISTRED_CALLBACK); SendDbgCommand(DID_REGISTRED_CALLBACK);
return CELL_OK; return CELL_OK;
} }
int cellSysutilUnregisterCallback(int slot) int cellSysutilUnregisterCallback(int slot)
{ {
cellSysutil.Warning("cellSysutilUnregisterCallback(slot=%d)", slot); cellSysutil->Warning("cellSysutilUnregisterCallback(slot=%d)", slot);
Emu.GetCallbackManager().m_exit_callback.Unregister(slot); Emu.GetCallbackManager().m_exit_callback.Unregister(slot);
wxGetApp().SendDbgCommand(DID_UNREGISTRED_CALLBACK); SendDbgCommand(DID_UNREGISTRED_CALLBACK);
return CELL_OK; return CELL_OK;
} }
@ -385,31 +386,31 @@ int cellMsgDialogOpen2(u32 type, char* msgString, mem_func_ptr_t<CellMsgDialogCa
if(type & CELL_MSGDIALOG_DIALOG_TYPE_NORMAL) if(type & CELL_MSGDIALOG_DIALOG_TYPE_NORMAL)
{ {
style |= wxICON_EXCLAMATION; style |= rICON_EXCLAMATION;
} }
else else
{ {
style |= wxICON_ERROR; style |= rICON_ERROR;
} }
if(type & CELL_MSGDIALOG_BUTTON_TYPE_YESNO) if(type & CELL_MSGDIALOG_BUTTON_TYPE_YESNO)
{ {
style |= wxYES_NO; style |= rYES_NO;
} }
else else
{ {
style |= wxOK; style |= rOK;
} }
int res = wxMessageBox(wxString(msgString, wxConvUTF8), wxGetApp().GetAppName(), style); int res = rMessageBox(std::string(msgString), rGetApp().GetAppName(), style);
u64 status; u64 status;
switch(res) switch(res)
{ {
case wxOK: status = CELL_MSGDIALOG_BUTTON_OK; break; case rOK: status = CELL_MSGDIALOG_BUTTON_OK; break;
case wxYES: status = CELL_MSGDIALOG_BUTTON_YES; break; case rYES: status = CELL_MSGDIALOG_BUTTON_YES; break;
case wxNO: status = CELL_MSGDIALOG_BUTTON_NO; break; case rNO: status = CELL_MSGDIALOG_BUTTON_NO; break;
default: default:
if(res) if(res)
@ -430,7 +431,7 @@ int cellMsgDialogOpen2(u32 type, char* msgString, mem_func_ptr_t<CellMsgDialogCa
int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallback> callback, mem_ptr_t<void> userData, u32 extParam) int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallback> callback, mem_ptr_t<void> 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); errorCode, callback.GetAddr(), userData, extParam);
std::string errorMessage; std::string errorMessage;
@ -508,10 +509,10 @@ int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallba
errorMessage.append(")\n"); errorMessage.append(")\n");
u64 status; u64 status;
int res = wxMessageBox(errorMessage, wxGetApp().GetAppName(), wxICON_ERROR | wxOK); int res = rMessageBox(errorMessage, rGetApp().GetAppName(), rICON_ERROR | rOK);
switch(res) switch(res)
{ {
case wxOK: status = CELL_MSGDIALOG_BUTTON_OK; break; case rOK: status = CELL_MSGDIALOG_BUTTON_OK; break;
default: default:
if(res) if(res)
{ {
@ -532,7 +533,7 @@ int cellMsgDialogOpenErrorCode(u32 errorCode, mem_func_ptr_t<CellMsgDialogCallba
int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option) int cellAudioOutGetSoundAvailability(u32 audioOut, u32 type, u32 fs, u32 option)
{ {
cellSysutil.Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)", cellSysutil->Warning("cellAudioOutGetSoundAvailability(audioOut=%d, type=%d, fs=0x%x, option=%d)",
audioOut, type, fs, option); audioOut, type, fs, option);
option = 0; 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) 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); audioOut, type, fs, ch, option);
option = 0; 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) int cellAudioOutGetState(u32 audioOut, u32 deviceIndex, u32 state_addr)
{ {
cellSysutil.Warning("cellAudioOutGetState(audioOut=0x%x,deviceIndex=0x%x,state_addr=0x%x)",audioOut,deviceIndex,state_addr); cellSysutil->Warning("cellAudioOutGetState(audioOut=0x%x,deviceIndex=0x%x,state_addr=0x%x)",audioOut,deviceIndex,state_addr);
CellAudioOutState state; CellAudioOutState state;
memset(&state, 0, sizeof(CellAudioOutState)); 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<CellAudioOutConfiguration> config, mem_ptr_t<CellAudioOutOption> option, u32 waitForEvent) int cellAudioOutConfigure(u32 audioOut, mem_ptr_t<CellAudioOutConfiguration> config, mem_ptr_t<CellAudioOutOption> 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); audioOut, config.GetAddr(), option.GetAddr(), waitForEvent);
if (!config.IsGood()) if (!config.IsGood())
@ -689,7 +690,7 @@ int cellAudioOutConfigure(u32 audioOut, mem_ptr_t<CellAudioOutConfiguration> con
int cellAudioOutGetConfiguration(u32 audioOut, u32 config_addr, u32 option_addr) 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); audioOut, config_addr, option_addr);
if(!Memory.IsGoodAddr(config_addr, sizeof(CellAudioOutConfiguration))) return CELL_EFAULT; 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) int cellAudioOutGetNumberOfDevice(u32 audioOut)
{ {
cellSysutil.Warning("cellAudioOutGetNumberOfDevice(videoOut=%d)",audioOut); cellSysutil->Warning("cellAudioOutGetNumberOfDevice(videoOut=%d)",audioOut);
switch(audioOut) switch(audioOut)
{ {
@ -732,7 +733,7 @@ int cellAudioOutGetNumberOfDevice(u32 audioOut)
int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_t<CellAudioOutDeviceInfo> info) int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_t<CellAudioOutDeviceInfo> 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()); audioOut, deviceIndex, info.GetAddr());
if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND; if(deviceIndex) return CELL_AUDIO_OUT_ERROR_DEVICE_NOT_FOUND;
@ -751,7 +752,7 @@ int cellAudioOutGetDeviceInfo(u32 audioOut, u32 deviceIndex, mem_ptr_t<CellAudio
int cellAudioOutSetCopyControl(u32 audioOut, u32 control) int cellAudioOutSetCopyControl(u32 audioOut, u32 control)
{ {
cellSysutil.Warning("cellAudioOutSetCopyControl(audioOut=%d,control=%d)",audioOut,control); cellSysutil->Warning("cellAudioOutSetCopyControl(audioOut=%d,control=%d)",audioOut,control);
switch(audioOut) switch(audioOut)
{ {
@ -785,28 +786,28 @@ typedef struct{
} CellSysCacheParam; } CellSysCacheParam;
class WxDirDeleteTraverser : public wxDirTraverser //class WxDirDeleteTraverser : public wxDirTraverser
{ //{
public: //public:
virtual wxDirTraverseResult OnFile(const wxString& filename) // virtual wxDirTraverseResult OnFile(const wxString& filename)
{ // {
if (!wxRemoveFile(filename)){ // if (!wxRemoveFile(filename)){
cellSysutil.Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); // cellSysutil->Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str());
} // }
return wxDIR_CONTINUE; // return wxDIR_CONTINUE;
} // }
virtual wxDirTraverseResult OnDir(const wxString& dirname) // virtual wxDirTraverseResult OnDir(const wxString& dirname)
{ // {
wxDir dir(dirname); // wxDir dir(dirname);
dir.Traverse(*this); // dir.Traverse(*this);
if (!wxRmDir(dirname)){ // if (!wxRmDir(dirname)){
//this get triggered a few times while clearing folders // //this get triggered a few times while clearing folders
//but if this gets reimplented we should probably warn // //but if this gets reimplented we should probably warn
//if directories can't be removed // //if directories can't be removed
} // }
return wxDIR_CONTINUE; // return wxDIR_CONTINUE;
} // }
}; //};
int cellSysCacheClear(void) int cellSysCacheClear(void)
{ {
@ -816,21 +817,23 @@ int cellSysCacheClear(void)
std::string localPath; std::string localPath;
Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath); Emu.GetVFS().GetDevice(std::string("/dev_hdd1/cache/"), localPath);
//TODO: replace wxWidgetsSpecific filesystem stuff //TODO: implement
if (wxDirExists(fmt::FromUTF8(localPath))){ //if (rDirExists(localPath)){
WxDirDeleteTraverser deleter; // WxDirDeleteTraverser deleter;
wxString f = wxFindFirstFile(fmt::FromUTF8(localPath+"\\*"),wxDIR); // wxString f = wxFindFirstFile(fmt::FromUTF8(localPath+"\\*"),wxDIR);
while (!f.empty()) // while (!f.empty())
{ // {
wxDir dir(f); // wxDir dir(f);
dir.Traverse(deleter); // dir.Traverse(deleter);
f = wxFindNextFile(); // f = wxFindNextFile();
} // }
// return CELL_SYSCACHE_RET_OK_CLEARED;
//}
//else{
// return CELL_SYSCACHE_ERROR_ACCESS_ERROR;
//}
return CELL_SYSCACHE_RET_OK_CLEARED; return CELL_SYSCACHE_RET_OK_CLEARED;
}
else{
return CELL_SYSCACHE_ERROR_ACCESS_ERROR;
}
} }
int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param) int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param)
@ -847,7 +850,7 @@ int cellSysCacheMount(mem_ptr_t<CellSysCacheParam> param)
int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t<CellHddGameStatCallback> funcStat, u32 container) int cellHddGameCheck(u32 version, u32 dirName_addr, u32 errDialog, mem_func_ptr_t<CellHddGameStatCallback> 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); version, dirName_addr, errDialog, funcStat, container);
if (!Memory.IsGoodAddr(dirName_addr) || !funcStat.IsGood()) 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<CellBgmPlaybackStatus> status) int cellSysutilGetBgmPlaybackStatus(mem_ptr_t<CellBgmPlaybackStatus> 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 // non-essential, so always assume background music is stopped/disabled
status->playbackState = CELL_BGMPLAYBACK_STATUS_STOP; status->playbackState = CELL_BGMPLAYBACK_STATUS_STOP;
@ -939,74 +942,74 @@ int cellWebBrowserEstimate2(mem8_ptr_t _config, mem32_ptr_t memSize)
void cellSysutil_init() void cellSysutil_init()
{ {
cellSysutil.AddFunc(0x40e895d3, cellSysutilGetSystemParamInt); cellSysutil->AddFunc(0x40e895d3, cellSysutilGetSystemParamInt);
cellSysutil.AddFunc(0x938013a0, cellSysutilGetSystemParamString); cellSysutil->AddFunc(0x938013a0, cellSysutilGetSystemParamString);
cellSysutil.AddFunc(0x887572d5, cellVideoOutGetState); cellSysutil->AddFunc(0x887572d5, cellVideoOutGetState);
cellSysutil.AddFunc(0xe558748d, cellVideoOutGetResolution); cellSysutil->AddFunc(0xe558748d, cellVideoOutGetResolution);
cellSysutil.AddFunc(0x0bae8772, cellVideoOutConfigure); cellSysutil->AddFunc(0x0bae8772, cellVideoOutConfigure);
cellSysutil.AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration); cellSysutil->AddFunc(0x15b0b0cd, cellVideoOutGetConfiguration);
cellSysutil.AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo); cellSysutil->AddFunc(0x1e930eef, cellVideoOutGetDeviceInfo);
cellSysutil.AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice); cellSysutil->AddFunc(0x75bbb672, cellVideoOutGetNumberOfDevice);
cellSysutil.AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability); cellSysutil->AddFunc(0xa322db75, cellVideoOutGetResolutionAvailability);
cellSysutil.AddFunc(0x189a74da, cellSysutilCheckCallback); cellSysutil->AddFunc(0x189a74da, cellSysutilCheckCallback);
cellSysutil.AddFunc(0x9d98afa0, cellSysutilRegisterCallback); cellSysutil->AddFunc(0x9d98afa0, cellSysutilRegisterCallback);
cellSysutil.AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback); cellSysutil->AddFunc(0x02ff3c1b, cellSysutilUnregisterCallback);
cellSysutil.AddFunc(0x7603d3db, cellMsgDialogOpen2); cellSysutil->AddFunc(0x7603d3db, cellMsgDialogOpen2);
cellSysutil.AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode); cellSysutil->AddFunc(0x3e22cb4b, cellMsgDialogOpenErrorCode);
cellSysutil.AddFunc(0xf4e3caa0, cellAudioOutGetState); cellSysutil->AddFunc(0xf4e3caa0, cellAudioOutGetState);
cellSysutil.AddFunc(0x4692ab35, cellAudioOutConfigure); cellSysutil->AddFunc(0x4692ab35, cellAudioOutConfigure);
cellSysutil.AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability); cellSysutil->AddFunc(0xc01b4e7c, cellAudioOutGetSoundAvailability);
cellSysutil.AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2); cellSysutil->AddFunc(0x2beac488, cellAudioOutGetSoundAvailability2);
cellSysutil.AddFunc(0x7663e368, cellAudioOutGetDeviceInfo); cellSysutil->AddFunc(0x7663e368, cellAudioOutGetDeviceInfo);
cellSysutil.AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice); cellSysutil->AddFunc(0xe5e2b09d, cellAudioOutGetNumberOfDevice);
cellSysutil.AddFunc(0xed5d96af, cellAudioOutGetConfiguration); cellSysutil->AddFunc(0xed5d96af, cellAudioOutGetConfiguration);
cellSysutil.AddFunc(0xc96e89e9, cellAudioOutSetCopyControl); cellSysutil->AddFunc(0xc96e89e9, cellAudioOutSetCopyControl);
cellSysutil.AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus); cellSysutil->AddFunc(0xa11552f6, cellSysutilGetBgmPlaybackStatus);
cellSysutil.AddFunc(0x1e7bff94, cellSysCacheMount); cellSysutil->AddFunc(0x1e7bff94, cellSysCacheMount);
cellSysutil.AddFunc(0x744c1544, cellSysCacheClear); cellSysutil->AddFunc(0x744c1544, cellSysCacheClear);
cellSysutil.AddFunc(0x9117df20, cellHddGameCheck); cellSysutil->AddFunc(0x9117df20, cellHddGameCheck);
//cellSysutil.AddFunc(0x4bdec82a, cellHddGameCheck2); //cellSysutil->AddFunc(0x4bdec82a, cellHddGameCheck2);
//cellSysutil.AddFunc(0xf82e2ef7, cellHddGameGetSizeKB); //cellSysutil->AddFunc(0xf82e2ef7, cellHddGameGetSizeKB);
//cellSysutil.AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer); //cellSysutil->AddFunc(0x9ca9ffa7, cellHddGameSetSystemVer);
//cellSysutil.AddFunc(0xafd605b3, cellHddGameExitBroken); //cellSysutil->AddFunc(0xafd605b3, cellHddGameExitBroken);
//cellSysutil_SaveData //cellSysutil_SaveData
//cellSysutil.AddFunc(0x04c06fc2, cellSaveDataGetListItem); //cellSysutil->AddFunc(0x04c06fc2, cellSaveDataGetListItem);
//cellSysutil.AddFunc(0x273d116a, cellSaveDataUserListExport); //cellSysutil->AddFunc(0x273d116a, cellSaveDataUserListExport);
//cellSysutil.AddFunc(0x27cb8bc2, cellSaveDataListDelete); //cellSysutil->AddFunc(0x27cb8bc2, cellSaveDataListDelete);
//cellSysutil.AddFunc(0x39d6ee43, cellSaveDataUserListImport); //cellSysutil->AddFunc(0x39d6ee43, cellSaveDataUserListImport);
//cellSysutil.AddFunc(0x46a2d878, cellSaveDataFixedExport); //cellSysutil->AddFunc(0x46a2d878, cellSaveDataFixedExport);
//cellSysutil.AddFunc(0x491cc554, cellSaveDataListExport); //cellSysutil->AddFunc(0x491cc554, cellSaveDataListExport);
//cellSysutil.AddFunc(0x52541151, cellSaveDataFixedImport); //cellSysutil->AddFunc(0x52541151, cellSaveDataFixedImport);
//cellSysutil.AddFunc(0x529231b0, cellSaveDataUserFixedImport); //cellSysutil->AddFunc(0x529231b0, cellSaveDataUserFixedImport);
//cellSysutil.AddFunc(0x6b4e0de6, cellSaveDataListImport); //cellSysutil->AddFunc(0x6b4e0de6, cellSaveDataListImport);
//cellSysutil.AddFunc(0x7048a9ba, cellSaveDataUserListDelete); //cellSysutil->AddFunc(0x7048a9ba, cellSaveDataUserListDelete);
//cellSysutil.AddFunc(0x95ae2cde, cellSaveDataUserFixedExport); //cellSysutil->AddFunc(0x95ae2cde, cellSaveDataUserFixedExport);
//cellSysutil.AddFunc(0xf6482036, cellSaveDataUserGetListItem); //cellSysutil->AddFunc(0xf6482036, cellSaveDataUserGetListItem);
cellSysutil.AddFunc(0x2de0d663, cellSaveDataListSave2); cellSysutil->AddFunc(0x2de0d663, cellSaveDataListSave2);
cellSysutil.AddFunc(0x1dfbfdd6, cellSaveDataListLoad2); cellSysutil->AddFunc(0x1dfbfdd6, cellSaveDataListLoad2);
cellSysutil.AddFunc(0x2aae9ef5, cellSaveDataFixedSave2); cellSysutil->AddFunc(0x2aae9ef5, cellSaveDataFixedSave2);
cellSysutil.AddFunc(0x2a8eada2, cellSaveDataFixedLoad2); cellSysutil->AddFunc(0x2a8eada2, cellSaveDataFixedLoad2);
cellSysutil.AddFunc(0x8b7ed64b, cellSaveDataAutoSave2); cellSysutil->AddFunc(0x8b7ed64b, cellSaveDataAutoSave2);
cellSysutil.AddFunc(0xfbd5c856, cellSaveDataAutoLoad2); cellSysutil->AddFunc(0xfbd5c856, cellSaveDataAutoLoad2);
//cellSysutil.AddFunc(0x4dd03a4e, cellSaveDataListAutoSave); //cellSysutil->AddFunc(0x4dd03a4e, cellSaveDataListAutoSave);
//cellSysutil.AddFunc(0x21425307, cellSaveDataListAutoLoad); //cellSysutil->AddFunc(0x21425307, cellSaveDataListAutoLoad);
//cellSysutil.AddFunc(0xedadd797, cellSaveDataDelete2); //cellSysutil->AddFunc(0xedadd797, cellSaveDataDelete2);
//cellSysutil.AddFunc(0x0f03cfb0, cellSaveDataUserListSave); //cellSysutil->AddFunc(0x0f03cfb0, cellSaveDataUserListSave);
//cellSysutil.AddFunc(0x39dd8425, cellSaveDataUserListLoad); //cellSysutil->AddFunc(0x39dd8425, cellSaveDataUserListLoad);
//cellSysutil.AddFunc(0x40b34847, cellSaveDataUserFixedSave); //cellSysutil->AddFunc(0x40b34847, cellSaveDataUserFixedSave);
//cellSysutil.AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad); //cellSysutil->AddFunc(0x6e7264ed, cellSaveDataUserFixedLoad);
//cellSysutil.AddFunc(0x52aac4fa, cellSaveDataUserAutoSave); //cellSysutil->AddFunc(0x52aac4fa, cellSaveDataUserAutoSave);
//cellSysutil.AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad); //cellSysutil->AddFunc(0xcdc6aefd, cellSaveDataUserAutoLoad);
//cellSysutil.AddFunc(0x0e091c36, cellSaveDataUserListAutoSave); //cellSysutil->AddFunc(0x0e091c36, cellSaveDataUserListAutoSave);
//cellSysutil.AddFunc(0xe7fa820b, cellSaveDataEnableOverlay); //cellSysutil->AddFunc(0xe7fa820b, cellSaveDataEnableOverlay);
cellSysutil.AddFunc(0x6d087930, cellWebBrowserEstimate2); cellSysutil->AddFunc(0x6d087930, cellWebBrowserEstimate2);
} }

View file

@ -6,8 +6,9 @@
#include "Emu/SysCalls/SC_FUNC.h" #include "Emu/SysCalls/SC_FUNC.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
void cellSysutilAp_init(); //void cellSysutilAp_init();
Module cellSysutilAp(0x0039, cellSysutilAp_init); //Module cellSysutilAp(0x0039, cellSysutilAp_init);
extern Module *cellSysutilAp = nullptr;
// Return Codes // Return Codes
enum enum
@ -24,7 +25,7 @@ enum
s32 cellSysutilApGetRequiredMemSize() s32 cellSysutilApGetRequiredMemSize()
{ {
cellSysutilAp.Log("cellSysutilApGetRequiredMemSize()"); cellSysutilAp->Log("cellSysutilApGetRequiredMemSize()");
return 1024*1024; // Return 1 MB as required size return 1024*1024; // Return 1 MB as required size
} }
@ -42,7 +43,7 @@ int cellSysutilApOff()
void cellSysutilAp_init() void cellSysutilAp_init()
{ {
cellSysutilAp.AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize); cellSysutilAp->AddFunc(0x9e67e0dd, cellSysutilApGetRequiredMemSize);
cellSysutilAp.AddFunc(0x3343824c, cellSysutilApOn); cellSysutilAp->AddFunc(0x3343824c, cellSysutilApOn);
cellSysutilAp.AddFunc(0x90c2bb19, cellSysutilApOff); cellSysutilAp->AddFunc(0x90c2bb19, cellSysutilApOff);
} }

View file

@ -12,7 +12,7 @@
#include "cellSysutil_SaveData.h" #include "cellSysutil_SaveData.h"
#include "Loader/PSF.h" #include "Loader/PSF.h"
extern Module cellSysutil; extern Module *cellSysutil;
// Auxiliary Classes // Auxiliary Classes
class sortSaveDataEntry class sortSaveDataEntry
@ -294,7 +294,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); 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()) if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
@ -379,7 +379,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList, m
mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataListCallback> funcList, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); 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()) if (!setList.IsGood() || !setBuf.IsGood() || !funcList.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
@ -464,7 +464,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); 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()) if (!setList.IsGood() || !setBuf.IsGood() || !funcFixed.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())
@ -536,7 +536,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t<CellSaveDataSetList> setList,
mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataFixedCallback> funcFixed, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); 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()) 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<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) 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<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile, mem_func_ptr_t<CellSaveDataStatCallback> funcStat, mem_func_ptr_t<CellSaveDataFileCallback> funcFile,
u32 container, u32 userdata_addr) 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); version, dirName_addr, errDialog, setBuf.GetAddr(), funcStat.GetAddr(), funcFile.GetAddr(), container, userdata_addr);
if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood()) if (!setBuf.IsGood() || !funcStat.IsGood() || !funcFile.IsGood())

View file

@ -8,12 +8,13 @@
#include "cellUserInfo.h" #include "cellUserInfo.h"
void cellUserInfo_init(); //void cellUserInfo_init();
Module cellUserInfo(0x0032, cellUserInfo_init); //Module cellUserInfo(0x0032, cellUserInfo_init);
extern Module *cellUserInfo = nullptr;
int cellUserInfoGetStat(u32 id, mem_ptr_t<CellUserInfoUserStat> stat) int cellUserInfoGetStat(u32 id, mem_ptr_t<CellUserInfoUserStat> 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()) if (!stat.IsGood())
return CELL_USERINFO_ERROR_PARAM; return CELL_USERINFO_ERROR_PARAM;
@ -61,7 +62,7 @@ int cellUserInfoEnableOverlay()
int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> listBuf, mem32_t currentUserId) int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> 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()); listNum.GetAddr(), listBuf.GetAddr(), currentUserId.GetAddr());
// If only listNum is NULL, an error will be returned // If only listNum is NULL, an error will be returned
@ -80,9 +81,9 @@ int cellUserInfoGetList(mem32_t listNum, mem_ptr_t<CellUserInfoUserList> listBuf
void cellUserInfo_init() void cellUserInfo_init()
{ {
cellUserInfo.AddFunc(0x2b761140, cellUserInfoGetStat); cellUserInfo->AddFunc(0x2b761140, cellUserInfoGetStat);
cellUserInfo.AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType); cellUserInfo->AddFunc(0x3097cc1c, cellUserInfoSelectUser_ListType);
cellUserInfo.AddFunc(0x55123a25, cellUserInfoSelectUser_SetList); cellUserInfo->AddFunc(0x55123a25, cellUserInfoSelectUser_SetList);
cellUserInfo.AddFunc(0xb3516536, cellUserInfoEnableOverlay); cellUserInfo->AddFunc(0xb3516536, cellUserInfoEnableOverlay);
cellUserInfo.AddFunc(0xc55e338b, cellUserInfoGetList); cellUserInfo->AddFunc(0xc55e338b, cellUserInfoGetList);
} }

View file

@ -18,8 +18,9 @@ extern "C"
#include "cellVdec.h" #include "cellVdec.h"
void cellVdec_init(); //void cellVdec_init();
Module cellVdec(0x0005, cellVdec_init); //Module cellVdec(0x0005, cellVdec_init);
Module *cellVdec = nullptr;
int vdecRead(void* opaque, u8* buf, int buf_size) 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 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_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_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_DIVX: cellVdec->Error("TODO: DIVX not supported"); break;
default: return CELL_VDEC_ERROR_ARG; default: return CELL_VDEC_ERROR_ARG;
} }
@ -127,7 +128,7 @@ u32 vdecOpen(VideoDecoder* data)
vdec.vdecCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU); vdec.vdecCb = &Emu.GetCPU().AddThread(CPU_THREAD_PPU);
u32 vdec_id = cellVdec.GetNewId(data); u32 vdec_id = cellVdec->GetNewId(data);
vdec.id = vdec_id; vdec.id = vdec_id;
@ -423,7 +424,7 @@ u32 vdecOpen(VideoDecoder* data)
int cellVdecQueryAttr(const mem_ptr_t<CellVdecType> type, mem_ptr_t<CellVdecAttr> attr) int cellVdecQueryAttr(const mem_ptr_t<CellVdecType> type, mem_ptr_t<CellVdecAttr> 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()) if (!type.IsGood() || !attr.IsGood())
{ {
@ -435,7 +436,7 @@ int cellVdecQueryAttr(const mem_ptr_t<CellVdecType> type, mem_ptr_t<CellVdecAttr
int cellVdecQueryAttrEx(const mem_ptr_t<CellVdecTypeEx> type, mem_ptr_t<CellVdecAttr> attr) int cellVdecQueryAttrEx(const mem_ptr_t<CellVdecTypeEx> type, mem_ptr_t<CellVdecAttr> 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()) if (!type.IsGood() || !attr.IsGood())
{ {
@ -447,7 +448,7 @@ int cellVdecQueryAttrEx(const mem_ptr_t<CellVdecTypeEx> type, mem_ptr_t<CellVdec
int cellVdecOpen(const mem_ptr_t<CellVdecType> type, const mem_ptr_t<CellVdecResource> res, const mem_ptr_t<CellVdecCb> cb, mem32_t handle) int cellVdecOpen(const mem_ptr_t<CellVdecType> type, const mem_ptr_t<CellVdecResource> res, const mem_ptr_t<CellVdecCb> 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()); type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
@ -467,7 +468,7 @@ int cellVdecOpen(const mem_ptr_t<CellVdecType> type, const mem_ptr_t<CellVdecRes
int cellVdecOpenEx(const mem_ptr_t<CellVdecTypeEx> type, const mem_ptr_t<CellVdecResourceEx> res, const mem_ptr_t<CellVdecCb> cb, mem32_t handle) int cellVdecOpenEx(const mem_ptr_t<CellVdecTypeEx> type, const mem_ptr_t<CellVdecResourceEx> res, const mem_ptr_t<CellVdecCb> 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()); type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood()) if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
@ -487,7 +488,7 @@ int cellVdecOpenEx(const mem_ptr_t<CellVdecTypeEx> type, const mem_ptr_t<CellVde
int cellVdecClose(u32 handle) int cellVdecClose(u32 handle)
{ {
cellVdec.Warning("cellVdecClose(handle=%d)", handle); cellVdec->Warning("cellVdecClose(handle=%d)", handle);
VideoDecoder* vdec; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -514,7 +515,7 @@ int cellVdecClose(u32 handle)
int cellVdecStartSeq(u32 handle) int cellVdecStartSeq(u32 handle)
{ {
cellVdec.Log("cellVdecStartSeq(handle=%d)", handle); cellVdec->Log("cellVdecStartSeq(handle=%d)", handle);
VideoDecoder* vdec; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -528,7 +529,7 @@ int cellVdecStartSeq(u32 handle)
int cellVdecEndSeq(u32 handle) int cellVdecEndSeq(u32 handle)
{ {
cellVdec.Warning("cellVdecEndSeq(handle=%d)", handle); cellVdec->Warning("cellVdecEndSeq(handle=%d)", handle);
VideoDecoder* vdec; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, 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<CellVdecAuInfo> auInfo) int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const mem_ptr_t<CellVdecAuInfo> 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; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -588,7 +589,7 @@ int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const mem_ptr_t<CellVd
int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u32 out_addr) int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> 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; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -617,13 +618,13 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
if (format->formatType != CELL_VDEC_PICFMT_YUV420_PLANAR) 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; return CELL_OK;
} }
if (format->colorMatrixType != CELL_VDEC_COLOR_MATRIX_TYPE_BT709) 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; return CELL_OK;
} }
@ -640,13 +641,13 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> 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); 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) 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(); Emu.Pause();
} }
if (!Memory.CopyFromReal(out_addr, buf, buf_size)) if (!Memory.CopyFromReal(out_addr, buf, buf_size))
{ {
cellVdec.Error("cellVdecGetPicture: data copying failed"); cellVdec->Error("cellVdecGetPicture: data copying failed");
Emu.Pause(); Emu.Pause();
} }
@ -660,7 +661,7 @@ int cellVdecGetPicture(u32 handle, const mem_ptr_t<CellVdecPicFormat> format, u3
int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr) 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; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, 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) 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; VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec)) if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -793,17 +794,17 @@ int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc)
void cellVdec_init() void cellVdec_init()
{ {
cellVdec.AddFunc(0xff6f6ebe, cellVdecQueryAttr); cellVdec->AddFunc(0xff6f6ebe, cellVdecQueryAttr);
cellVdec.AddFunc(0xc982a84a, cellVdecQueryAttrEx); cellVdec->AddFunc(0xc982a84a, cellVdecQueryAttrEx);
cellVdec.AddFunc(0xb6bbcd5d, cellVdecOpen); cellVdec->AddFunc(0xb6bbcd5d, cellVdecOpen);
cellVdec.AddFunc(0x0053e2d8, cellVdecOpenEx); cellVdec->AddFunc(0x0053e2d8, cellVdecOpenEx);
cellVdec.AddFunc(0x16698e83, cellVdecClose); cellVdec->AddFunc(0x16698e83, cellVdecClose);
cellVdec.AddFunc(0xc757c2aa, cellVdecStartSeq); cellVdec->AddFunc(0xc757c2aa, cellVdecStartSeq);
cellVdec.AddFunc(0x824433f0, cellVdecEndSeq); cellVdec->AddFunc(0x824433f0, cellVdecEndSeq);
cellVdec.AddFunc(0x2bf4ddd2, cellVdecDecodeAu); cellVdec->AddFunc(0x2bf4ddd2, cellVdecDecodeAu);
cellVdec.AddFunc(0x807c861a, cellVdecGetPicture); cellVdec->AddFunc(0x807c861a, cellVdecGetPicture);
cellVdec.AddFunc(0x17c702b9, cellVdecGetPicItem); cellVdec->AddFunc(0x17c702b9, cellVdecGetPicItem);
cellVdec.AddFunc(0xe13ef6fc, cellVdecSetFrameRate); cellVdec->AddFunc(0xe13ef6fc, cellVdecSetFrameRate);
av_register_all(); av_register_all();
avcodec_register_all(); avcodec_register_all();

View file

@ -13,12 +13,13 @@ extern "C"
#include "cellVpost.h" #include "cellVpost.h"
void cellVpost_init(); //void cellVpost_init();
Module cellVpost(0x0008, cellVpost_init); //Module cellVpost(0x0008, cellVpost_init);
Module *cellVpost = nullptr;
int cellVpostQueryAttr(const mem_ptr_t<CellVpostCfgParam> cfgParam, mem_ptr_t<CellVpostAttr> attr) int cellVpostQueryAttr(const mem_ptr_t<CellVpostCfgParam> cfgParam, mem_ptr_t<CellVpostAttr> 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 (!cfgParam.IsGood()) return CELL_VPOST_ERROR_Q_ARG_CFG_NULL;
if (!attr.IsGood()) return CELL_VPOST_ERROR_Q_ARG_ATTR_NULL; if (!attr.IsGood()) return CELL_VPOST_ERROR_Q_ARG_ATTR_NULL;
@ -35,7 +36,7 @@ int cellVpostQueryAttr(const mem_ptr_t<CellVpostCfgParam> cfgParam, mem_ptr_t<Ce
u32 vpostOpen(VpostInstance* data) u32 vpostOpen(VpostInstance* data)
{ {
u32 id = cellVpost.GetNewId(data); u32 id = cellVpost->GetNewId(data);
ConLog.Write("*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id); 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<CellVpostCfgParam> cfgParam, const mem_ptr_t<CellVpostResource> resource, mem32_t handle) int cellVpostOpen(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t<CellVpostResource> 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()); cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr());
if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL; if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL;
@ -58,7 +59,7 @@ int cellVpostOpen(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t<C
int cellVpostOpenEx(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t<CellVpostResourceEx> resource, mem32_t handle) int cellVpostOpenEx(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t<CellVpostResourceEx> 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()); cfgParam.GetAddr(), resource.GetAddr(), handle.GetAddr());
if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL; if (!cfgParam.IsGood()) return CELL_VPOST_ERROR_O_ARG_CFG_NULL;
@ -72,7 +73,7 @@ int cellVpostOpenEx(const mem_ptr_t<CellVpostCfgParam> cfgParam, const mem_ptr_t
int cellVpostClose(u32 handle) int cellVpostClose(u32 handle)
{ {
cellVpost.Warning("cellVpostClose(handle=0x%x)", handle); cellVpost->Warning("cellVpostClose(handle=0x%x)", handle);
VpostInstance* vpost; VpostInstance* vpost;
if (!Emu.GetIdManager().GetIDData(handle, 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<CellVpostCtrlParam> ctrlParam, int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpostCtrlParam> ctrlParam,
u32 outPicBuff_addr, mem_ptr_t<CellVpostPictureInfo> picInfo) u32 outPicBuff_addr, mem_ptr_t<CellVpostPictureInfo> 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()); handle, inPicBuff_addr, ctrlParam.GetAddr(), outPicBuff_addr, picInfo.GetAddr());
VpostInstance* vpost; VpostInstance* vpost;
@ -170,19 +171,19 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h)) if (!Memory.CopyToReal(pY, inPicBuff_addr, w*h))
{ {
cellVpost.Error("cellVpostExec: data copying failed(pY)"); cellVpost->Error("cellVpostExec: data copying failed(pY)");
Emu.Pause(); Emu.Pause();
} }
if (!Memory.CopyToReal(pU, inPicBuff_addr + w*h, w*h/4)) 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(); Emu.Pause();
} }
if (!Memory.CopyToReal(pV, inPicBuff_addr + w*h + w*h/4, w*h/4)) 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(); Emu.Pause();
} }
@ -207,7 +208,7 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
if (!Memory.CopyFromReal(outPicBuff_addr, res, ow*oh*4)) if (!Memory.CopyFromReal(outPicBuff_addr, res, ow*oh*4))
{ {
cellVpost.Error("cellVpostExec: data copying failed(result)"); cellVpost->Error("cellVpostExec: data copying failed(result)");
Emu.Pause(); Emu.Pause();
} }
@ -224,9 +225,9 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_t<CellVpos
void cellVpost_init() void cellVpost_init()
{ {
cellVpost.AddFunc(0x95e788c3, cellVpostQueryAttr); cellVpost->AddFunc(0x95e788c3, cellVpostQueryAttr);
cellVpost.AddFunc(0xcd33f3e2, cellVpostOpen); cellVpost->AddFunc(0xcd33f3e2, cellVpostOpen);
cellVpost.AddFunc(0x40524325, cellVpostOpenEx); cellVpost->AddFunc(0x40524325, cellVpostOpenEx);
cellVpost.AddFunc(0x10ef39f6, cellVpostClose); cellVpost->AddFunc(0x10ef39f6, cellVpostClose);
cellVpost.AddFunc(0xabb8cc3d, cellVpostExec); cellVpost->AddFunc(0xabb8cc3d, cellVpostExec);
} }

View file

@ -8,8 +8,9 @@
#include "Emu/Audio/cellAudio.h" #include "Emu/Audio/cellAudio.h"
#include "libmixer.h" #include "libmixer.h"
void libmixer_init(); //void libmixer_init();
Module libmixer("libmixer", libmixer_init); //Module libmixer("libmixer", libmixer_init);
Module *libmixer = nullptr;
CellSurMixerConfig surMixer; 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) 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); aan_handle, aan_port, offset, addr, samples);
} }
else 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); aan_handle, aan_port, offset, addr, samples);
Emu.Pause(); Emu.Pause();
return CELL_OK; 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) 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); receive, receivePortNo, source, sourcePortNo);
return CELL_OK; return CELL_OK;
} }
int cellAANDisconnect(u32 receive, u32 receivePortNo, u32 source, u32 sourcePortNo) 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); receive, receivePortNo, source, sourcePortNo);
return CELL_OK; return CELL_OK;
} }
int cellSSPlayerCreate(mem32_t handle, mem_ptr_t<CellSSPlayerConfig> config) int cellSSPlayerCreate(mem32_t handle, mem_ptr_t<CellSSPlayerConfig> 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()); handle.GetAddr(), config.GetAddr());
return CELL_OK; return CELL_OK;
} }
int cellSSPlayerRemove(u32 handle) int cellSSPlayerRemove(u32 handle)
{ {
libmixer.Error("cellSSPlayerRemove(handle=%d)", handle); libmixer->Error("cellSSPlayerRemove(handle=%d)", handle);
return CELL_OK; return CELL_OK;
} }
int cellSSPlayerSetWave(u32 handle, mem_ptr_t<CellSSPlayerWaveParam> waveInfo, mem_ptr_t<CellSSPlayerCommonParam> commonInfo) int cellSSPlayerSetWave(u32 handle, mem_ptr_t<CellSSPlayerWaveParam> waveInfo, mem_ptr_t<CellSSPlayerCommonParam> 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()); handle, waveInfo.GetAddr(), commonInfo.GetAddr());
return CELL_OK; return CELL_OK;
} }
int cellSSPlayerPlay(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> info) int cellSSPlayerPlay(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> 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; return CELL_OK;
} }
int cellSSPlayerStop(u32 handle, u32 mode) 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; return CELL_OK;
} }
int cellSSPlayerSetParam(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> info) int cellSSPlayerSetParam(u32 handle, mem_ptr_t<CellSSPlayerRuntimeInfo> 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; return CELL_OK;
} }
s32 cellSSPlayerGetState(u32 handle) s32 cellSSPlayerGetState(u32 handle)
{ {
libmixer.Error("cellSSPlayerGetState(handle=%d) -> OFF", handle); libmixer->Error("cellSSPlayerGetState(handle=%d) -> OFF", handle);
return CELL_SSPLAYER_STATE_OFF; return CELL_SSPLAYER_STATE_OFF;
} }
int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config) int cellSurMixerCreate(const mem_ptr_t<CellSurMixerConfig> config)
{ {
libmixer.Warning("cellSurMixerCreate(config_addr=0x%x)", config.GetAddr()); libmixer->Warning("cellSurMixerCreate(config_addr=0x%x)", config.GetAddr());
surMixer = *config; 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); (u32)surMixer.chStrips1, (u32)surMixer.chStrips2, (u32)surMixer.chStrips6, (u32)surMixer.chStrips8);
return CELL_OK; return CELL_OK;
} }
int cellSurMixerGetAANHandle(mem32_t handle) 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; handle = 0x11111111;
return CELL_OK; return CELL_OK;
} }
int cellSurMixerChStripGetAANPortNo(mem32_t port, u32 type, u32 index) 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; port = (type << 16) | index;
return CELL_OK; return CELL_OK;
} }
int cellSurMixerSetNotifyCallback(u32 func, u32 arg) 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; surMixerCb = func;
surMixerCbArg = arg; surMixerCbArg = arg;
return CELL_OK; return CELL_OK;
@ -197,7 +198,7 @@ int cellSurMixerSetNotifyCallback(u32 func, u32 arg)
int cellSurMixerRemoveNotifyCallback(u32 func) 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; surMixerCb = 0;
surMixerCbArg = 0; surMixerCbArg = 0;
return CELL_OK; return CELL_OK;
@ -205,7 +206,7 @@ int cellSurMixerRemoveNotifyCallback(u32 func)
int cellSurMixerStart() int cellSurMixerStart()
{ {
libmixer.Warning("cellSurMixerStart()"); libmixer->Warning("cellSurMixerStart()");
AudioPortConfig& port = m_config.m_ports[SUR_PORT]; AudioPortConfig& port = m_config.m_ports[SUR_PORT];
@ -219,7 +220,7 @@ int cellSurMixerStart()
port.attr = 0; port.attr = 0;
port.level = 1.0f; port.level = 1.0f;
libmixer.Warning("*** audio port opened(default)"); libmixer->Warning("*** audio port opened(default)");
port.m_is_audio_port_opened = true; port.m_is_audio_port_opened = true;
port.tag = 0; port.tag = 0;
@ -282,13 +283,13 @@ int cellSurMixerStart()
int cellSurMixerSetParameter(u32 param, float value) 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; return CELL_OK;
} }
int cellSurMixerFinalize() int cellSurMixerFinalize()
{ {
libmixer.Warning("cellSurMixerFinalize()"); libmixer->Warning("cellSurMixerFinalize()");
AudioPortConfig& port = m_config.m_ports[SUR_PORT]; 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) 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 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(); Emu.Pause();
return CELL_OK; 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<CellSurMixerChStripParam> param) int cellSurMixerChStripSetParameter(u32 type, u32 index, mem_ptr_t<CellSurMixerChStripParam> 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; return CELL_OK;
} }
int cellSurMixerPause(u32 type) int cellSurMixerPause(u32 type)
{ {
libmixer.Error("cellSurMixerPause(type=%d)", type); libmixer->Error("cellSurMixerPause(type=%d)", type);
return CELL_OK; return CELL_OK;
} }
int cellSurMixerGetCurrentBlockTag(mem64_t tag) 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; return CELL_OK;
} }
int cellSurMixerGetTimestamp(u64 tag, mem64_t stamp) 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; return CELL_OK;
} }
void cellSurMixerBeep(u32 arg) void cellSurMixerBeep(u32 arg)
{ {
libmixer.Error("cellSurMixerBeep(arg=%d)", arg); libmixer->Error("cellSurMixerBeep(arg=%d)", arg);
return; return;
} }
void cellSurMixerUtilGetLevelFromDB(float dB) void cellSurMixerUtilGetLevelFromDB(float dB)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer.Error("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB); libmixer->Error("cellSurMixerUtilGetLevelFromDB(dB=%f)", dB);
declCPU(); declCPU();
(float&)CPU.FPR[0] = 0.0f; (float&)CPU.FPR[0] = 0.0f;
} }
@ -368,7 +369,7 @@ void cellSurMixerUtilGetLevelFromDB(float dB)
void cellSurMixerUtilGetLevelFromDBIndex(int index) void cellSurMixerUtilGetLevelFromDBIndex(int index)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer.Error("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index); libmixer->Error("cellSurMixerUtilGetLevelFromDBIndex(index=%d)", index);
declCPU(); declCPU();
(float&)CPU.FPR[0] = 0.0f; (float&)CPU.FPR[0] = 0.0f;
} }
@ -376,7 +377,7 @@ void cellSurMixerUtilGetLevelFromDBIndex(int index)
void cellSurMixerUtilNoteToRatio(u8 refNote, u8 note) void cellSurMixerUtilNoteToRatio(u8 refNote, u8 note)
{ {
// not hooked, probably unnecessary // not hooked, probably unnecessary
libmixer.Error("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note); libmixer->Error("cellSurMixerUtilNoteToRatio(refNote=%d, note=%d)", refNote, note);
declCPU(); declCPU();
(float&)CPU.FPR[0] = 0.0f; (float&)CPU.FPR[0] = 0.0f;
} }

View file

@ -1,4 +1,3 @@
#if 0
#pragma once #pragma once
//libsnd3 Error Codes //libsnd3 Error Codes
@ -53,4 +52,3 @@ struct CellSnd3RequestQueueCtx
void *rearQueue; void *rearQueue;
be_t<u32> rearQueueSize; be_t<u32> rearQueueSize;
}; };
#endif

Some files were not shown because too many files have changed in this diff Show more